Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closing bracket in URI should be escaped #284

Closed
nbeisert opened this issue Dec 13, 2015 · 1 comment
Closed

closing bracket in URI should be escaped #284

nbeisert opened this issue Dec 13, 2015 · 1 comment
Assignees
Labels
bug Existing features not working as expected

Comments

@nbeisert
Copy link

An html link <a> whose href contains a closing bracket ) leads to a PDF with a slightly corrupted structure because the bracket is not escaped as \) in the PDF element. In practice the link is terminated at the bracket (and the following text might get interpreted as further PDF elements)

Example:

<html><head><title>test</title></head>
<body>
<a href="http://test/closing)bracket">link</a>
</body>
</html>

This is translated to a PDF with the element /URI (http://test/closing)bracket) which should rather be /URI (http://test/closing\)bracket).
Checking the integrity of the PDF leads to a warning/error, e.g.: qpdf --check test.pdf outputs:

test.pdf (file position 4990): unknown token while reading object (bracket)

Tried with version 0.23 and present version on github.

Potentially, some other characters are affected as well? E.g., the backslash \ itself is converted to %5C.

@liZe liZe added the bug Existing features not working as expected label Dec 14, 2015
@liZe
Copy link
Member

liZe commented Dec 16, 2015

According to the spec, we only need to escape parenthesis and backslashes.

@liZe liZe self-assigned this Dec 16, 2015
@liZe liZe closed this as completed in 36338b4 Dec 16, 2015
jsonn referenced this issue in jsonn/pkgsrc Jan 8, 2016
Version 0.25
------------

Released on 2015-12-17.

New features:

* Support the 'q' unit.

Bug fixes:

* `#285: <https://github.com/Kozea/WeasyPrint/issues/285>`_:
  Fix a crash happening when splitting lines.
* `#284: <https://github.com/Kozea/WeasyPrint/issues/284>`_:
  Escape parenthesis in PDF links.
* `#280: <https://github.com/Kozea/WeasyPrint/pull/280>`_:
  Replace utf8 with utf-8 for gettext/django compatibility.
* `#269: <https://github.com/Kozea/WeasyPrint/pull/269>`_:
  Add support for use when frozen.
* `#250: <https://github.com/Kozea/WeasyPrint/issues/250>`_:
  Don't crash when attachments are not available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants