Skip to content

Embedded image fix#196

Merged
onizet merged 3 commits intoonizet:devfrom
Tranquilite0:embedded-image-fix
Apr 7, 2025
Merged

Embedded image fix#196
onizet merged 3 commits intoonizet:devfrom
Tranquilite0:embedded-image-fix

Conversation

@Tranquilite0
Copy link
Contributor

The regex for matching data URIs was only matching MIME types consisting of word characters which means data URIs with valid MIME types like 'svg+xml' would be rejected. Looking at the list of registered mime types (https://www.iana.org/assignments/media-types/media-types.xhtml) I determined that the regex should also match ., -, and +.

Also I had some data URIs with embedded .emf files so I updated knownContentType to allow .emf files.

Correct dataUriRegex to match mime types which contain '-', '+' or '.' such as 'svg+xml' or 'x-png'.
Add emf content types to knownContentType to allow data uris with embedded emf files.
@onizet
Copy link
Owner

onizet commented Apr 6, 2025

That's an amazing PR! Thanks for that submit.
One point: you should not remove the .ConfigureAwait(false) because this is needed for .Net 4.8 (and ASP.Net WebForms) which lacks a proper support of async.
Can you please restore that removed line from your PR?

Restore ConfigureAwait(false)
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 6, 2025

@Tranquilite0
Copy link
Contributor Author

Good catch, I didn't intend to make that change. Also I tried to make the requested change through GitHub directly, and now it is showing all lines as changed? Did GitHub just redo all the line endings or something? This is my first time submitting a pull request through GitHub.

@onizet
Copy link
Owner

onizet commented Apr 7, 2025

Yes, I think it messed up with the line ending. I define a editor.config file at the root of the project to unify the code along multiple developer. I'm not so familiar neither. I'm going to merge that PR and handle whitespaces if needed. Thanks for your support!

@onizet onizet merged commit 71ca1b7 into onizet:dev Apr 7, 2025
1 of 3 checks passed
@onizet onizet mentioned this pull request Apr 24, 2025
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