mirror of
https://github.com/immich-app/immich.git
synced 2024-12-26 10:50:29 +02:00
9 lines
246 B
Dart
9 lines
246 B
Dart
|
String sanitizeUrl(String url) {
|
||
|
// Add schema if none is set
|
||
|
final urlWithSchema =
|
||
|
url.startsWith(RegExp(r"https?://")) ? url : "https://$url";
|
||
|
|
||
|
// Remove trailing slash(es)
|
||
|
return urlWithSchema.replaceFirst(RegExp(r"/+$"), "");
|
||
|
}
|