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

Default configuration not dompdf 3.1 friendly when using data-uris #1070

Open
uandco opened this issue Jan 21, 2025 · 6 comments
Open

Default configuration not dompdf 3.1 friendly when using data-uris #1070

uandco opened this issue Jan 21, 2025 · 6 comments

Comments

@uandco
Copy link

uandco commented Jan 21, 2025

Describe the bug

dompdf 3.1.0 now validates data-uris, which makes data-uris fail with the default config file as it doesn't have any data:// entry in the allowed_protocols config array:

See discussion at dompdf/dompdf#3580

To Reproduce

Use the default config file, update composer, which will update dompdf/dompdf to 3.1
Use a data-uri for an image in the view used to generate PDFs

Expected behavior

data-uris should continue working as they were with dompdf 3.0.2

Additional context

Imho, the example config file should have:

'allowed_protocols' => [
    "data://" => ["rules" => []],
    "file://" => ["rules" => []],
    "http://" => ["rules" => []],
    "https://" => ["rules" => []]
],

instead of

'allowed_protocols' => [
    "file://" => ["rules" => []],
    "http://" => ["rules" => []],
    "https://" => ["rules" => []]
],

I reckon mentioning this in some release note on the next version would also help mitigating issues for those not noticing the dompdf/dompdf dependency gets updated and start breaking resources using data-uris.

@infabo
Copy link

infabo commented Jan 21, 2025

Also see changelog: https://github.com/dompdf/dompdf/releases/tag/v3.1.0

Note: this change requires that users of data URIs include the "data://" scheme in the list of allowed protocols

@barryvdh
Copy link
Owner

Can you update your the latest release?

@uandco
Copy link
Author

uandco commented Jan 21, 2025

That would work but existing installs would have to update the config manually.

@infabo
Copy link

infabo commented Jan 22, 2025

When configuration is published - yes. This change must be mentioned in release changelog of this package as an important change (when not even considering as a breaking change).

@barryvdh
Copy link
Owner

I added a not the the changelog and release page; https://github.com/barryvdh/laravel-dompdf/releases/tag/v3.1.0

@infabo
Copy link

infabo commented Jan 28, 2025

@barryvdh Thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants