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: garbled characters caused by atob #422

Merged
merged 2 commits into from
Jul 22, 2024
Merged

Conversation

52funny
Copy link
Contributor

@52funny 52funny commented Jul 22, 2024

Author your commit #421 solves some problems but creates some new ones. For example, when the folder is some non-ASCII form of string, it may cause garbled problems. The root cause is that the atob function only accept a few ASCII characters, resulting in errors parsing strings beyond the 0xff range.

index.js #L111

image

This commit fixes a problem with atob not parsing non-ASCII characters. The Uint32Array view is utilized to process 4 bytes at a time, potentially providing an additional performance boost when working with large amounts of data.

assets/index.js Outdated
@@ -100,6 +100,25 @@ let $userBtn;
*/
let $userName;

// Parsing base64 strings with Unicode characters
function decodeBase64WithUnicode(base64String) {
Copy link
Owner

@sigoden sigoden Jul 22, 2024

Choose a reason for hiding this comment

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

Please rename the function to decodeBase64 and move to the end of the file.

@52funny
Copy link
Contributor Author

52funny commented Jul 22, 2024

I have changed the function name as required and moved it to the bottom. Thanks for the advice. Have a nice day!

@sigoden sigoden merged commit 7aba3fe into sigoden:main Jul 22, 2024
3 checks passed
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