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:
parent
cd3962e7b3
commit
2d7fa20557
1 changed files with 8 additions and 6 deletions
|
@ -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';
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue