Skip to content

Commit

Permalink
fix # in file name
Browse files Browse the repository at this point in the history
  • Loading branch information
tamlok committed Feb 13, 2019
1 parent 0e8cde6 commit 239d3e2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions js/navigationrenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class NavigationRenderer {
v_type: 'folder',
v_name: folder.name,
// Path of this item without ending /.
v_path: basePath + folder.name
v_path: basePath + encodeURIComponent(folder.name)
};

children.push(folderItem);
Expand All @@ -146,7 +146,7 @@ class NavigationRenderer {
// Viki specific attrs.
v_type: 'file',
v_name: file.name,
v_path: basePath + file.name
v_path: basePath + encodeURIComponent(file.name)
};

children.push(fileItem);
Expand Down
2 changes: 1 addition & 1 deletion js/naviworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class NaviWorker extends Worker {
// Route current access target through navigation items.
routeTarget() {
let items = this.viki.naviItems;
let target = this.viki.info.target.toLowerCase();
let target = decodeURIComponent(this.viki.info.target).toLowerCase();

let utils = new Utils();

Expand Down
3 changes: 1 addition & 2 deletions js/viki.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ class Viki {
target = "index.md";
}

target = decodeURIComponent(target);

// Do not decode URI here.
// Anchor.
let idx = target.indexOf('#');
if (idx != -1) {
Expand Down
4 changes: 2 additions & 2 deletions js/vikiinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import Utils from "./utils.js";

class VikiInfo {
constructor() {
// Target page specified by user.
// Target page specified by user (encoded).
this.target = '';

// Anchor within target page.
// Anchor within target page (encoded).
this.anchor = '';

// Base url.
Expand Down

0 comments on commit 239d3e2

Please sign in to comment.