Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ shiny-server 1.5.16

* Upgrade Node.js to 12.20.0.

* Fix issue with Unicode characters being escaped incorrectly in directory
listings.

shiny-server 1.5.15
--------------------------------------------------------------------------------

Expand Down
10 changes: 5 additions & 5 deletions lib/router/directory-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function DirectoryRouter(root, runas, dirIndex, prefix, logdir, settings,
var suffix = pathname.substring(prefix.length);

// Disallow hidden path elements, ".", and ".."
if (/\/\./.test(unescape(pathname)) ||
if (/\/\./.test(decodeURIComponent(pathname)) ||
(this.$blacklist && this.$blacklist.exec(suffix))) {
render.sendPage(res, 403, 'Forbidden', {
template: 'error-403',
Expand Down Expand Up @@ -162,7 +162,7 @@ function DirectoryRouter(root, runas, dirIndex, prefix, logdir, settings,
}

var indexPath = path.normalize(path.join(
self.$root, unescape(this.path), 'index.html'));
self.$root, decodeURIComponent(this.path), 'index.html'));

fs.exists(indexPath, function(exists) {
if (exists) {
Expand Down Expand Up @@ -201,7 +201,7 @@ function DirectoryRouter(root, runas, dirIndex, prefix, logdir, settings,
};

this.$autoindex_p = function(req, res, apath, filter) {
var unescapedPath = unescape(apath);
var unescapedPath = decodeURIComponent(apath);
var dirpath = path.normalize(path.join(this.$root, unescapedPath));
var self = this;
return Q.nfcall(fs.readdir, dirpath)
Expand Down Expand Up @@ -240,7 +240,7 @@ function DirectoryRouter(root, runas, dirIndex, prefix, logdir, settings,
return _.map(names, function(name) {
return {
name: name,
url: escape(name)
url: encodeURIComponent(name)
};
});
}
Expand Down Expand Up @@ -421,7 +421,7 @@ function extractUnescapedDirs(p) {
// This can happen if p ends with /, since we match on $
if (lastpos > p.length)
break;
element = unescape(p.substring(lastpos, m.index));
element = decodeURIComponent(p.substring(lastpos, m.index));
lastpos = m.index + 1;

// empty? ignore.
Expand Down