mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 16:48:08 +02:00
Merge pull request #6834 from Snuffleupagus/issue-6832
Strip `null` (\x00) characters from the URLs in LinkAnnotations (issue 6832)
This commit is contained in:
commit
4399d01169
7 changed files with 33 additions and 25 deletions
|
@ -1,20 +1,8 @@
|
|||
/* globals expect, it, describe, binarySearchFirstItem, removeNullCharacters */
|
||||
/* globals expect, it, describe, binarySearchFirstItem */
|
||||
|
||||
'use strict';
|
||||
|
||||
describe('ui_utils', function() {
|
||||
describe('removeNullCharacters', function() {
|
||||
it('should not modify string without null characters', function() {
|
||||
var str = 'string without null chars';
|
||||
expect(removeNullCharacters(str)).toEqual('string without null chars');
|
||||
});
|
||||
|
||||
it('should modify string with null characters', function() {
|
||||
var str = 'string\x00With\x00Null\x00Chars';
|
||||
expect(removeNullCharacters(str)).toEqual('stringWithNullChars');
|
||||
});
|
||||
});
|
||||
|
||||
describe('binary search', function() {
|
||||
function isTrue(boolean) {
|
||||
return boolean;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* globals expect, it, describe, combineUrl, Dict, isDict, Name, PDFJS,
|
||||
stringToPDFString, isExternalLinkTargetSet, LinkTarget */
|
||||
stringToPDFString, isExternalLinkTargetSet, LinkTarget,
|
||||
removeNullCharacters */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -125,4 +126,16 @@ describe('util', function() {
|
|||
// Reset the state.
|
||||
PDFJS.externalLinkTarget = previousExternalLinkTarget;
|
||||
});
|
||||
|
||||
describe('removeNullCharacters', function() {
|
||||
it('should not modify string without null characters', function() {
|
||||
var str = 'string without null chars';
|
||||
expect(removeNullCharacters(str)).toEqual('string without null chars');
|
||||
});
|
||||
|
||||
it('should modify string with null characters', function() {
|
||||
var str = 'string\x00With\x00Null\x00Chars';
|
||||
expect(removeNullCharacters(str)).toEqual('stringWithNullChars');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue