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

Bugfix: handle SVGs containing images embedded as data URIs #534

Merged
merged 1 commit into from Nov 16, 2017

Conversation

Projects
None yet
3 participants
@martijnthe
Contributor

martijnthe commented Nov 11, 2017

The dict returned from open_data_url does not contain a file_obj key. This line was throwing a key error before.
Fix: avoid accessing the non-existent key.

Fixes #529.

Bugfix: handle SVGs containing images embedded as data URIs
The `dict` returned from `open_data_url` does not contain a `file_obj` key. This line was throwing a key error before.
Fix: avoid accessing the non-existent key.

Fixes #529.
@martijnthe

This comment has been minimized.

Show comment
Hide comment
@martijnthe

martijnthe Nov 11, 2017

Contributor

@liZe I'm sorry for not adding a unit test.
I had trouble getting them to run locally properly.

Contributor

martijnthe commented Nov 11, 2017

@liZe I'm sorry for not adding a unit test.
I had trouble getting them to run locally properly.

@martijnthe

This comment has been minimized.

Show comment
Hide comment
@martijnthe

martijnthe Nov 12, 2017

Contributor

hrmm.. the failed unit test looks unrelated to the change I made, it also only failed on the macOS build...

=================================== FAILURES ===================================
______________________________ test_overflow_wrap ______________________________
    @assert_no_logs
    def test_overflow_wrap():
        def get_lines(wrap, text):
            page, = parse('''
                <style>
                    body {width: 80px; overflow: hidden; font-family: ahem; }
                    span {overflow-wrap: %s; white-space: normal; }
                </style>
                <body style="hyphens: auto;" lang="en">
                    <span>%s
            ''' % (wrap, text))
            html, = page.children
            body, = html.children
            body_lines = []
            for line in body.children:
                box, = line.children
                textBox, = box.children
                body_lines.append(textBox.text)
            return body_lines
    
        # break-word
        lines = get_lines('break-word', 'aaaaaaaa')
>       assert len(lines) > 1
E       AssertionError: assert 1 > 1
E        +  where 1 = len(['aaaaaaaa'])
weasyprint/tests/test_text.py:581: AssertionError
============== 1 failed, 303 passed, 1 xfailed in 100.05 seconds ===============

Any ideas @liZe?

Contributor

martijnthe commented Nov 12, 2017

hrmm.. the failed unit test looks unrelated to the change I made, it also only failed on the macOS build...

=================================== FAILURES ===================================
______________________________ test_overflow_wrap ______________________________
    @assert_no_logs
    def test_overflow_wrap():
        def get_lines(wrap, text):
            page, = parse('''
                <style>
                    body {width: 80px; overflow: hidden; font-family: ahem; }
                    span {overflow-wrap: %s; white-space: normal; }
                </style>
                <body style="hyphens: auto;" lang="en">
                    <span>%s
            ''' % (wrap, text))
            html, = page.children
            body, = html.children
            body_lines = []
            for line in body.children:
                box, = line.children
                textBox, = box.children
                body_lines.append(textBox.text)
            return body_lines
    
        # break-word
        lines = get_lines('break-word', 'aaaaaaaa')
>       assert len(lines) > 1
E       AssertionError: assert 1 > 1
E        +  where 1 = len(['aaaaaaaa'])
weasyprint/tests/test_text.py:581: AssertionError
============== 1 failed, 303 passed, 1 xfailed in 100.05 seconds ===============

Any ideas @liZe?

@astraujums

This comment has been minimized.

Show comment
Hide comment
@astraujums

astraujums Nov 13, 2017

Thanks!

I have updated my local Weasyprint installation and the error from Kozea#529 is gone.

astraujums commented on 38ac25b Nov 13, 2017

Thanks!

I have updated my local Weasyprint installation and the error from Kozea#529 is gone.

This comment has been minimized.

Show comment
Hide comment
@martijnthe
Owner

martijnthe replied Nov 13, 2017

👍

@liZe

This comment has been minimized.

Show comment
Hide comment
@liZe

liZe Nov 16, 2017

Member

Thank you for this pull request!

hrmm.. the failed unit test looks unrelated to the change I made, it also only failed on the macOS build...

Yes, it's a bug in Pango 1.40.13 fixed in Pango 1.40.14, we can safely ignore the problem.

Member

liZe commented Nov 16, 2017

Thank you for this pull request!

hrmm.. the failed unit test looks unrelated to the change I made, it also only failed on the macOS build...

Yes, it's a bug in Pango 1.40.13 fixed in Pango 1.40.14, we can safely ignore the problem.

@liZe liZe merged commit bd5e58f into Kozea:master Nov 16, 2017

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

@liZe liZe added this to the v0.42 milestone Nov 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment