mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Parenthesis in names are not escaped when saving
This commit is contained in:
parent
d88d47d621
commit
18b525de2e
2 changed files with 19 additions and 1 deletions
|
@ -205,7 +205,22 @@ function escapePDFName(str) {
|
|||
let start = 0;
|
||||
for (let i = 0, ii = str.length; i < ii; i++) {
|
||||
const char = str.charCodeAt(i);
|
||||
if (char < 0x21 || char > 0x7e || char === 0x23) {
|
||||
// Whitespace or delimiters aren't regular chars, so escape them.
|
||||
if (
|
||||
char < 0x21 ||
|
||||
char > 0x7e ||
|
||||
char === 0x23 /* # */ ||
|
||||
char === 0x28 /* ( */ ||
|
||||
char === 0x29 /* ) */ ||
|
||||
char === 0x3c /* < */ ||
|
||||
char === 0x3e /* > */ ||
|
||||
char === 0x5b /* [ */ ||
|
||||
char === 0x5d /* ] */ ||
|
||||
char === 0x7b /* { */ ||
|
||||
char === 0x7d /* } */ ||
|
||||
char === 0x2f /* / */ ||
|
||||
char === 0x25 /* % */
|
||||
) {
|
||||
if (start < i) {
|
||||
buffer.push(str.substring(start, i));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue