Commit 9ca30be0 authored by Sean Hammond's avatar Sean Hammond

Replace %20 with space when displaying filenames

parent ef9655d6
...@@ -21,12 +21,12 @@ module.exports = function() { ...@@ -21,12 +21,12 @@ module.exports = function() {
var parts = uri.split('/'); var parts = uri.split('/');
var filename = parts[parts.length - 1]; var filename = parts[parts.length - 1];
if (filename) { if (filename) {
return '(' + filename + ')'; return '(' + decodeURIComponent(filename) + ')';
} }
} }
if (domain && domain !== title) { if (domain && domain !== title) {
return '(' + domain + ')'; return '(' + decodeURIComponent(domain) + ')';
} else { } else {
return ''; return '';
} }
......
...@@ -38,6 +38,15 @@ describe('documentDomain', function() { ...@@ -38,6 +38,15 @@ describe('documentDomain', function() {
assert(domain === '(MyFile.pdf)'); 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() { it('escapes HTML in the document domain', function() {
var spamLink = '<a href="http://example.com/rubies">Buy rubies!!!</a>'; var spamLink = '<a href="http://example.com/rubies">Buy rubies!!!</a>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment