mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-10 04:46:07 -08:00
feat(dictionary): add Hachidori backend support (#266)
This commit is contained in:
1 parent
e690ffba07
commit
cbaa4626e1
143 files changed
+5564
-305
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { parseDictionaryExternalUrl } from './dictionary-external-link';
|
||||
|
||||
test('dictionary links accept web URLs and reject privileged schemes and credentials', () => {
|
||||
assert.equal(
|
||||
parseDictionaryExternalUrl('https://example.com/word?q=猫'),
|
||||
'https://example.com/word?q=%E7%8C%AB',
|
||||
);
|
||||
for (const value of [
|
||||
'file:///etc/passwd',
|
||||
'javascript:alert(1)',
|
||||
'https://user:pass@example.com',
|
||||
null,
|
||||
{},
|
||||
]) {
|
||||
assert.throws(() => parseDictionaryExternalUrl(value));
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user