fix(mobile): server endpoint input auto parse https when not specified (#5326)

This fixes issue #4397 and automatically adds the https protocol to the server endpoint url if it is missing

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
avaness
2023-11-28 22:02:19 -06:00
committed by GitHub
parent 2a45ad147c
commit 5a2fc20b20
2 changed files with 7 additions and 7 deletions

View File

@@ -3,10 +3,10 @@ import 'package:immich_mobile/shared/models/store.dart';
String sanitizeUrl(String url) {
// Add schema if none is set
final urlWithSchema =
url.startsWith(RegExp(r"https?://")) ? url : "https://$url";
url.trimLeft().startsWith(RegExp(r"https?://")) ? url : "https://$url";
// Remove trailing slash(es)
return urlWithSchema.replaceFirst(RegExp(r"/+$"), "");
return urlWithSchema.trimRight().replaceFirst(RegExp(r"/+$"), "");
}
String? getServerUrl() {