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

Fix: How to check the image extension from Uri. #5344

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rustbasic
Copy link
Contributor

@rustbasic rustbasic commented Nov 3, 2024

Fix: How to check the image extension from Uri.

It addresses most of what was discussed in #5341, but I'm not sure if it addresses everything.

Copy link

github-actions bot commented Nov 3, 2024

Preview available at https://egui-pr-preview.github.io/pr/5344-patch145
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@xangelix
Copy link
Contributor

xangelix commented Nov 5, 2024

Thank you for the PR to resolve an issue I introduced and apologies that my previous changes have caused issues for you, though I have concerns that this PR would still fail in some web URI scenarios.

Also, if this were to be the direction we go, you'd almost certainly want to do something like this to avoid having to keep extensions in sync with the image crate manually :)

    ImageFormat::all()
        .filter(ImageFormat::reading_enabled)
        .flat_map(ImageFormat::extensions_str)
        .any(|format_ext| uri.contains(*format_ext))

@rustbasic
Copy link
Contributor Author

Thank you for the PR to resolve an issue I introduced and apologies that my previous changes have caused issues for you, though I have concerns that this PR would still fail in some web URI scenarios.

Also, if this were to be the direction we go, you'd almost certainly want to do something like this to avoid having to keep extensions in sync with the image crate manually :)

    ImageFormat::all()
        .filter(ImageFormat::reading_enabled)
        .flat_map(ImageFormat::extensions_str)
        .any(|format_ext| uri.contains(*format_ext))

I have modified this PR as you said.
If you want to make a PR, I will close this PR once you submit it.

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.

2 participants