0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-02-18 01:24:26 -05:00

Automatically apply /api to server URL if missing

This commit is contained in:
Ashley Bailey 2025-01-08 22:29:42 +00:00
parent cd3962e7b3
commit 2d7fa20557

View file

@ -94,12 +94,14 @@ class LoginForm extends HookConsumerWidget {
);
}
// Automatically add /api to URL if missing
if (!serverUrl.endsWith('/api') || serverUrl.endsWith('/api/')) {
if (!serverUrl.endsWith('/')) {
serverUrl = String($sanitizedUrl + '/api');
}
serverUrl = String($sanitizedUrl + 'api');
// Automatically add /api to serverUrl if missing
serverUrl = serverUrl.trim();
// Check if the string ends with '/api/' and remove the trailing slash if it does or add '/api' if the string doesn't end with '/api'
if (serverUrl.endsWith('/api/')) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
} else if (!serverUrl.endsWith('/api')) {
serverUrl = '$serverUrl/api';
}