Strip null (\x00) characters from the URLs in LinkAnnotations (issue 6832)

Apparently some PDF files can have annotations with `URI` entries ending with `null` characters, thus breaking the links.
To handle this edge-case of bad PDFs, this patch moves the already existing utility function from `ui_utils.js` into `util.js`, in order to fix those URLs.

Fixes 6832.
This commit is contained in:
Jonas Jenwald 2016-01-04 21:33:41 +01:00
parent 4e9ea35eee
commit 97c10e9c08
7 changed files with 33 additions and 25 deletions

View file

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals removeNullCharacters */
/* globals PDFJS */
'use strict';
@ -137,7 +137,7 @@ var PDFOutlineView = (function PDFOutlineViewClosure() {
div.className = 'outlineItem';
var element = document.createElement('a');
this._bindLink(element, item);
element.textContent = removeNullCharacters(item.title);
element.textContent = PDFJS.removeNullCharacters(item.title);
div.appendChild(element);
if (item.items.length > 0) {