1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

All: Fixes 12810: Ensure the sync shows an error when the server is down, when using a local WebDAV server (#13301)

This commit is contained in:
mrjo118
2025-10-09 21:59:58 +01:00
committed by GitHub
parent 820acdc1f0
commit 53ea51b758
3 changed files with 39 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
import { PaginatedList, RemoteItem, getSupportsDeltaWithItems } from './file-api';
import { PaginatedList, RemoteItem, getSupportsDeltaWithItems, isLocalServer } from './file-api';
const defaultPaginatedList = (): PaginatedList => {
return {
@@ -70,4 +70,28 @@ describe('file-api', () => {
expect(actual).toBe(expected);
});
it.each([
'http://localhost',
'http://localhost/',
'https://localhost:8080',
'http://127.0.0.1',
'https://127.100.50.25:3000/test',
'http://[::1]',
'http://localhost/api/v1',
])('should detect a local server url', (url: string) => {
const result = isLocalServer(url);
expect(result).toBe(true);
});
it.each([
'http://localhostXYZ',
'http://127.0.0.1foobar',
'http://192.168.1.1',
'http://example.com',
'https://my-localhost.com',
])('should detect a non local server url', (url: string) => {
const result = isLocalServer(url);
expect(result).toBe(false);
});
});