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:
Jonas Jenwald 2015-09-09 23:42:22 +02:00
parent 3daae40425
commit b7d1bed463
3 changed files with 10 additions and 3 deletions

View file

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals getFileName */
/* globals getFileName, removeNullCharacters */
'use strict';
@ -91,7 +91,7 @@ var PDFAttachmentView = (function PDFAttachmentViewClosure() {
div.className = 'attachmentsItem';
var button = document.createElement('button');
this._bindLink(button, item.content, filename);
button.textContent = filename;
button.textContent = removeNullCharacters(filename);
div.appendChild(button);
this.container.appendChild(div);
}