Allow hashes in app data paths
This commit is contained in:
parent
6e36aa7a8b
commit
41d6dadb78
2 changed files with 1 additions and 32 deletions
|
@ -42,9 +42,8 @@ export function _urlToPath(
|
||||||
: decoded.slice(options?.isWindows ? 8 : 7);
|
: decoded.slice(options?.isWindows ? 8 : 7);
|
||||||
|
|
||||||
const withoutQuerystring = _eliminateAllAfterCharacter(withoutScheme, '?');
|
const withoutQuerystring = _eliminateAllAfterCharacter(withoutScheme, '?');
|
||||||
const withoutHash = _eliminateAllAfterCharacter(withoutQuerystring, '#');
|
|
||||||
|
|
||||||
return withoutHash;
|
return withoutQuerystring;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _createFileHandler({
|
function _createFileHandler({
|
||||||
|
|
|
@ -7,16 +7,6 @@ import { _urlToPath } from '../../../app/protocol_filter';
|
||||||
|
|
||||||
describe('Protocol Filter', () => {
|
describe('Protocol Filter', () => {
|
||||||
describe('_urlToPath', () => {
|
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', () => {
|
it('returns proper file path for unix style file URI with querystring', () => {
|
||||||
const path =
|
const path =
|
||||||
'file:///Users/someone/Development/signal/electron/background.html?name=Signal&locale=en&version=2.4.0';
|
'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);
|
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', () => {
|
it('returns proper file path for file URI on windows', () => {
|
||||||
const path =
|
const path =
|
||||||
'file:///C:/Users/Someone/dev/desktop/background.html?name=Signal&locale=en&version=2.4.0';
|
'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);
|
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', () => {
|
it('handles UNC path', () => {
|
||||||
const path = '//share/path';
|
const path = '//share/path';
|
||||||
const expected = '//share/path';
|
const expected = '//share/path';
|
||||||
|
|
Loading…
Reference in a new issue