Skip to content

Commit 8b7779d

Browse files
committed
If '/' is the last character of a custom QFieldCloud server URL, slice it out
1 parent 5d0fa4d commit 8b7779d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/qml/QFieldCloudLogin.qml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,13 @@ Item {
260260
}
261261

262262
function prefixUrlWithProtocol(url) {
263-
if (!url || url.startsWith('http://') || url.startsWith('https://'))
264-
return url;
265-
return 'https://' + url;
263+
let cleanedUrl = url.trim();
264+
if (cleanedUrl.endsWith('/')) {
265+
cleanedUrl = cleanedUrl.slice(0, -1);
266+
}
267+
if (!cleanedUrl || cleanedUrl.startsWith('http://') || cleanedUrl.startsWith('https://'))
268+
return cleanedUrl;
269+
return 'https://' + cleanedUrl;
266270
}
267271

268272
function loginFormSumbitHandler() {

0 commit comments

Comments
 (0)