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

fixes #497 Keep image data URI if no image data is loaded #498

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

ptc-tgamper
Copy link
Contributor

Do not discard image data uri if uri still needed

Do not discard image data uri if uri still needed
return false;
// If image has a uri, and it is not a data uri, use it as filename
if (!image.uri.empty()) {
if (!IsDataURI(image.uri)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we can end up here with a data URI, so protect against that case

// If the image is encoded as data URI, and the actual image data was
// not extracted, then we keep the original data URI that holds all
// the data.
if (IsDataURI(uri) && ok && image->image.empty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the uri only if the data has not been loaded. Otherwise we have it in memory twice.

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

Successfully merging this pull request may close these issues.

1 participant