Skip to content

Conversation

@halex2005
Copy link
Contributor

@halex2005 halex2005 commented Nov 13, 2023

Hi! Thanks for great utilities site.

I have found that base64-file-converter tool doesn't work properly.
The downloaded file has content of site's index.html if I've paste base64 string without preifx like data:plain/text;base64,.

This PR fixes that behavior by adding data:plain/text;base64, to base64 string if data: not found in the input string.
Please, consider to review and merge this PR.

Reproducing

Example of plain base64 string for testing:

c2VydmVyIHsNCiAgICBsaXN0ZW4gODA7DQogICAgc2VydmVyX25hbWUgbG9jYWxob3N0Ow0KICAgIHJvb3QgL3Vzci9zaGFyZS9uZ2lueC9odG1sOw0KICAgIGluZGV4IGluZGV4Lmh0bWw7DQoNCiAgICBsb2NhdGlvbiAvIHsNCiAgICAgICAgdHJ5X2ZpbGVzICR1cmkgJHVyaS8gL2luZGV4Lmh0bWw7DQogICAgfQ0KfQ==

With this input, in main branch, click on "Download file" button will download HTML of site. In PR branch it will download correct byte representation of base64 content.

@vercel
Copy link

vercel bot commented Nov 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
it-tools ✅ Ready (Inspect) Visit Preview Nov 13, 2023 7:53am

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@CorentinTh
Copy link
Owner

Hi @halex2005 !

Thank you for finding this bug and the PR to fix it !
I added a small features : sometimes when we do not have the data uri we can still infer the mime type using the base64 file signature.

I cannot push on your PR due to the fork, so I opened #750 from your to keep you commit in contribution

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