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-image-extension should probably not apply on encoded data url images #9118

Closed
cderv opened this issue Oct 3, 2023 · 0 comments
Closed
Labels

Comments

@cderv
Copy link
Contributor

cderv commented Oct 3, 2023

When setting --default-image-extension, it will also apply on already encoded image adding the extension, and creating a bad image.

Probably that extension should not be added when image provided is already a Data URL

This is with Pandoc 3.1.8 using a real data uri for this image

> pandoc -t html
![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfmBAoMCxP4pHXqAAABPElEQVRIx+2VPUsDQRRFT2IiogYiFkFsrNRWsUljYSFBJIWFIiJWgpXgP9DCwsIihSCWIigiiKVJ4Q9QQRFsopUQCLFZxEJYuTbrsutuktktJXeaeY+5580nAx39ez0ixGpc+zhCiOu4gB0sXhA2ueaDki0AS1xyAnSxHKf+BKLAKELcxgHs0SAF3CHEWPQlLHKBDZwCsBK1fh4xDcAw34jXqIASbySc/g1C5KPYk9TYd6N1hDiIAphBTLnRAF+IBmlzwBFVX3yFEPOm9hTvziX2t7PwwUHNMsg2dU8mQYk0RTJ8mMzgmJp7Ar+qIMSaib0Hi8NAdhMhyiaABUQhkB1BCJuh9oBzLLpD8k8IsdXO3sdn+G6zixD3rR9Tlg16eSYbsPc7r2GSOTLNqpc9Z173Qap/bsRD57vw6gfG+WjL6VYS6QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wNC0xMFQxMjoxMToxOSswMDowMMYvzF0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDQtMTBUMTI6MTE6MTkrMDA6MDC3cnThAAAAAElFTkSuQmCC)
^Z
<p><img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfmBAoMCxP4pHXqAAABPElEQVRIx+2VPUsDQRRFT2IiogYiFkFsrNRWsUljYSFBJIWFIiJWgpXgP9DCwsIihSCWIigiiKVJ4Q9QQRFsopUQCLFZxEJYuTbrsutuktktJXeaeY+5580nAx39ez0ixGpc+zhCiOu4gB0sXhA2ueaDki0AS1xyAnSxHKf+BKLAKELcxgHs0SAF3CHEWPQlLHKBDZwCsBK1fh4xDcAw34jXqIASbySc/g1C5KPYk9TYd6N1hDiIAphBTLnRAF+IBmlzwBFVX3yFEPOm9hTvziX2t7PwwUHNMsg2dU8mQYk0RTJ8mMzgmJp7Ar+qIMSaib0Hi8NAdhMhyiaABUQhkB1BCJuh9oBzLLpD8k8IsdXO3sdn+G6zixD3rR9Tlg16eSYbsPc7r2GSOTLNqpc9Z173Qap/bsRD57vw6gfG+WjL6VYS6QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wNC0xMFQxMjoxMToxOSswMDowMMYvzF0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDQtMTBUMTI6MTE6MTkrMDA6MDC3cnThAAAAAElFTkSuQmCC" /></p>

# Extension will be added on the data url where it shouldn't to preserve the image
> pandoc -t html --default-image-extension=png
![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfmBAoMCxP4pHXqAAABPElEQVRIx+2VPUsDQRRFT2IiogYiFkFsrNRWsUljYSFBJIWFIiJWgpXgP9DCwsIihSC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sdn+G6zixD3rR9Tlg16eSYbsPc7r2GSOTLNqpc9Z173Qap/bsRD57vw6gfG+WjL6VYS6QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wNC0xMFQxMjoxMToxOSswMDowMMYvzF0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDQtMTBUMTI6MTE6MTkrMDA6MDC3cnThAAAAAElFTkSuQmCC.png" /></p>

For context, this was first discussed in quarto-dev/quarto-cli#6568

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

No branches or pull requests

1 participant