mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Add a utility function, for the viewer, that removes null
(\x00) characters (issue 6416)
Since some browsers render `null` characters, and others don't, this patch adds a way to remove them to prevent display issues in the viewer UI. Given that documents may contain very long outlines, I've added a utility function to avoid creating a lot of unnecessary `RegExp` objects. To avoid any future issues, this utility function is used for both the outline and the attachments. Fixes 6416.
This commit is contained in:
parent
3daae40425
commit
b7d1bed463
3 changed files with 10 additions and 3 deletions
|
@ -75,6 +75,12 @@ var CustomStyle = (function CustomStyleClosure() {
|
|||
return CustomStyle;
|
||||
})();
|
||||
|
||||
var NullCharactersRegExp = /\x00/g;
|
||||
|
||||
function removeNullCharacters(str) {
|
||||
return str.replace(NullCharactersRegExp, '');
|
||||
}
|
||||
|
||||
function getFileName(url) {
|
||||
var anchor = url.indexOf('#');
|
||||
var query = url.indexOf('?');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue