Skip to content

Commit

Permalink
Replace %20 with space when displaying filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
seanh committed Oct 8, 2015
1 parent 7ec1574 commit 2b0b320
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions h/static/scripts/filter/document-domain.js
Expand Up @@ -21,12 +21,12 @@ module.exports = function() {
var parts = uri.split('/');
var filename = parts[parts.length - 1];
if (filename) {
return '(' + filename + ')';
return '(' + decodeURIComponent(filename) + ')';
}
}

if (domain && domain !== title) {
return '(' + domain + ')';
return '(' + decodeURIComponent(domain) + ')';
} else {
return '';
}
Expand Down
9 changes: 9 additions & 0 deletions h/static/scripts/filter/test/document-domain-test.js
Expand Up @@ -38,6 +38,15 @@ describe('documentDomain', function() {
assert(domain === '(MyFile.pdf)');
});

it('replaces %20 with " "', function() {
var domain = documentDomainFilterProvider()({
title: 'example.com',
uri: 'file:///home/seanh/My%20File.pdf'
});

assert(domain === '(My File.pdf)');
});

it('escapes HTML in the document domain', function() {
var spamLink = '<a href="http://example.com/rubies">Buy rubies!!!</a>';

Expand Down

0 comments on commit 2b0b320

Please sign in to comment.