mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
PDF names need to be escaped when saving
This commit is contained in:
parent
f9d56320f5
commit
dc4eb71ff1
4 changed files with 56 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
import { Dict, Ref } from "../../src/core/primitives.js";
|
||||
import {
|
||||
escapePDFName,
|
||||
getInheritableProperty,
|
||||
isWhiteSpace,
|
||||
log2,
|
||||
|
@ -226,4 +227,16 @@ describe("core_utils", function () {
|
|||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("escapePDFName", function () {
|
||||
it("should escape PDF name", function () {
|
||||
expect(escapePDFName("hello")).toEqual("hello");
|
||||
expect(escapePDFName("\xfehello")).toEqual("#fehello");
|
||||
expect(escapePDFName("he\xfell\xffo")).toEqual("he#fell#ffo");
|
||||
expect(escapePDFName("\xfehe\xfell\xffo\xff")).toEqual(
|
||||
"#fehe#fell#ffo#ff"
|
||||
);
|
||||
expect(escapePDFName("#h#e#l#l#o")).toEqual("#23h#23e#23l#23l#23o");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue