-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Previously, we were applying toLowerCase on the whole path causing the WebView to return 401 on resources (such as images)
- Loading branch information
1 parent
d0df68a
commit 4d86a4c
Showing
3 changed files
with
46 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os from 'os' | ||
import { Uri } from 'vscode' | ||
import chai from 'chai' | ||
import { normalizeUri } from '../util/workspace' | ||
|
||
const expect = chai.expect | ||
|
||
suite('Normalize URI', () => { | ||
test('Should lowercase drive letter on Windows', async () => { | ||
if (os.platform() === 'win32') { | ||
const result = normalizeUri(Uri.parse('file:///C:/path/WITH/camelCase/A/b/C/index.adoc')) | ||
expect(result.path).to.equal('/c:/path/WITH/camelCase/A/b/C/index.adoc') | ||
} | ||
}) | ||
test('Should do nothing since the drive letter is already lowercase', async () => { | ||
if (os.platform() === 'win32') { | ||
const result = normalizeUri(Uri.parse('file:///c:/path/WITH/camelCase/A/b/C/index.adoc')) | ||
expect(result.path).to.equal('/c:/path/WITH/camelCase/A/b/C/index.adoc') | ||
} | ||
}) | ||
test('Should do nothing on Linux', async () => { | ||
if (os.platform() !== 'win32') { | ||
const result = normalizeUri(Uri.parse('/C/path/WITH/camelCase/A/b/C/index.adoc')) | ||
expect(result.path).to.equal('/C/path/WITH/camelCase/A/b/C/index.adoc') | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters