Skip to content

Commit b744edb

Browse files
committed
remove more unused stuff
1 parent a634d1e commit b744edb

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

web_src/js/features/comp/EditorUpload.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {imageInfo} from '../../utils/image.ts';
2-
import {isUrl} from '../../utils/url.ts';
32
import {textareaInsertText, triggerEditorContentChanged} from './EditorMarkdown.ts';
43
import {
54
DropzoneCustomEventRemovedFile,

web_src/js/utils/url.test.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
import {pathEscapeSegments, isUrl, toOriginUrl} from './url.ts';
1+
import {pathEscapeSegments, toOriginUrl} from './url.ts';
22

33
test('pathEscapeSegments', () => {
44
expect(pathEscapeSegments('a/b/c')).toEqual('a/b/c');
55
expect(pathEscapeSegments('a/b/ c')).toEqual('a/b/%20c');
66
});
77

8-
test('isUrl', () => {
9-
expect(isUrl('https://example.com')).toEqual(true);
10-
expect(isUrl('https://example.com/')).toEqual(true);
11-
expect(isUrl('https://example.com/index.html')).toEqual(true);
12-
expect(isUrl('/index.html')).toEqual(false);
13-
});
14-
158
test('toOriginUrl', () => {
169
const oldLocation = String(window.location);
1710
for (const origin of ['https://example.com', 'https://example.com:3000']) {

web_src/js/utils/url.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@ export function pathEscapeSegments(s: string): string {
22
return s.split('/').map(encodeURIComponent).join('/');
33
}
44

5-
function stripSlash(url: string): string {
6-
return url.endsWith('/') ? url.slice(0, -1) : url;
7-
}
8-
9-
export function isUrl(url: string): boolean {
10-
try {
11-
return stripSlash((new URL(url).href)).trim() === stripSlash(url).trim();
12-
} catch {
13-
return false;
14-
}
15-
}
16-
175
/** Convert an absolute or relative URL to an absolute URL with the current origin. It only
186
* processes absolute HTTP/HTTPS URLs or relative URLs like '/xxx' or '//host/xxx'. */
197
export function toOriginUrl(urlStr: string) {

0 commit comments

Comments
 (0)