Skip to content

Commit

Permalink
Fix parsing uri with special caracters
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro-Bronsveld committed Sep 29, 2023
1 parent 3ac8252 commit 67feff0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/note-types/lookup-note-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const lookupNoteType = async (uri: vscode.Uri, ankiConnect: AnkiConnect):

if (parts.length === 0) {
// Uri is root of note types folder, return list of note type directories
console.log("fetching modelNames");
// console.log("fetching modelNames");
const modelNames = await ankiConnect.getModelNames();

const rootDir = new Directory("");
Expand Down
4 changes: 3 additions & 1 deletion src/note-types/uri-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const partsToUri = (parts: string[]): vscode.Uri => {
parts[2] = escapeText(parts[2]);
}

const path = resultParts.join("/");
const path = resultParts
.map(part => encodeURIComponent(part))
.join("/");
return vscode.Uri.parse(`${ANKI_EDITOR_SCHEME}${path}`);
}

0 comments on commit 67feff0

Please sign in to comment.