Allow hashes in app data paths

This commit is contained in:
trevor-signal 2023-08-22 12:25:01 -04:00 committed by GitHub
parent 6e36aa7a8b
commit 41d6dadb78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 32 deletions

View File

@ -42,9 +42,8 @@ export function _urlToPath(
: decoded.slice(options?.isWindows ? 8 : 7);
const withoutQuerystring = _eliminateAllAfterCharacter(withoutScheme, '?');
const withoutHash = _eliminateAllAfterCharacter(withoutQuerystring, '#');
return withoutHash;
return withoutQuerystring;
}
function _createFileHandler({

View File

@ -7,16 +7,6 @@ import { _urlToPath } from '../../../app/protocol_filter';
describe('Protocol Filter', () => {
describe('_urlToPath', () => {
it('returns proper file path for unix style file URI with hash', () => {
const path =
'file:///Users/someone/Development/signal/electron/background.html#first-page';
const expected =
'/Users/someone/Development/signal/electron/background.html';
const actual = _urlToPath(path);
assert.strictEqual(actual, expected);
});
it('returns proper file path for unix style file URI with querystring', () => {
const path =
'file:///Users/someone/Development/signal/electron/background.html?name=Signal&locale=en&version=2.4.0';
@ -27,16 +17,6 @@ describe('Protocol Filter', () => {
assert.strictEqual(actual, expected);
});
it('returns proper file path for unix style file URI with hash and querystring', () => {
const path =
'file:///Users/someone/Development/signal/electron/background.html#somewhere?name=Signal';
const expected =
'/Users/someone/Development/signal/electron/background.html';
const actual = _urlToPath(path);
assert.strictEqual(actual, expected);
});
it('returns proper file path for file URI on windows', () => {
const path =
'file:///C:/Users/Someone/dev/desktop/background.html?name=Signal&locale=en&version=2.4.0';
@ -57,16 +37,6 @@ describe('Protocol Filter', () => {
assert.strictEqual(actual, expected);
});
it('translates from URL format to filesystem format', () => {
const path =
'file:///Users/someone/Development%20Files/signal/electron/background.html';
const expected =
'/Users/someone/Development Files/signal/electron/background.html';
const actual = _urlToPath(path);
assert.strictEqual(actual, expected);
});
it('handles UNC path', () => {
const path = '//share/path';
const expected = '//share/path';