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: When previewing some SVG, 'btoa' report error: The string to be encoded contains characters outside of the Latin1 range." #2432

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

XinRoom
Copy link
Contributor

@XinRoom XinRoom commented Aug 20, 2024

When previewing some SVG, report error:
viewer-main.mjs?v=79b66689-10:588 Error evaluating async computed property: Error: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

report error example:

btoa(`<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
    <defs>
        <pattern name="中文" id="smallGrid" width="10" height="10" patternUnits="userSpaceOnUse">
            <path d="M 10 0 L 0 0 0 10" fill="none" stroke="gray" stroke-width="0.5"/>
        </pattern>
        <pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse">
            <rect width="100" height="100" fill="url(#smallGrid)"/>
            <path d="M 100 0 L 0 0 0 100" fill="none" stroke="gray" stroke-width="1"/>
        </pattern>
    </defs>
    <rect width="100%" height="100%" fill="url(#grid)" />
</svg>`)

fix by btoa(unescape(encodeURIComponent(data)))

ref: https://stackoverflow.com/questions/23223718/failed-to-execute-btoa-on-window-the-string-to-be-encoded-contains-characte

@skjnldsv

This comment was marked as resolved.

…Window': The string to be encoded contains characters outside of the Latin1 range."

When previewing SVG, report error:
`viewer-main.mjs?v=79b66689-10:588 Error evaluating async computed property: Error: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.`

ref: https://stackoverflow.com/questions/23223718/failed-to-execute-btoa-on-window-the-string-to-be-encoded-contains-characte

Signed-off-by: XinRoom <[email protected]>
@skjnldsv skjnldsv added bug Something isn't working 4. to release Ready to be released and/or waiting for tests to finish labels Aug 20, 2024
@skjnldsv
Copy link
Member

/backport to stable29

@skjnldsv

This comment was marked as resolved.

@backportbot backportbot bot added the backport-request Pending backport by the backport-bot label Aug 20, 2024
@skjnldsv skjnldsv merged commit 35ca667 into nextcloud:master Aug 20, 2024
21 of 29 checks passed

This comment was marked as resolved.

@skjnldsv
Copy link
Member

/backport to stable30

Copy link

github-actions bot commented Sep 4, 2024

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@skjnldsv
Copy link
Member

skjnldsv commented Sep 5, 2024

/backport to stable29

@backportbot backportbot bot added the backport-request Pending backport by the backport-bot label Sep 5, 2024
Copy link

backportbot bot commented Sep 5, 2024

The backport to stable29 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable29
git pull origin stable29

# Create the new backport branch
git checkout -b backport/2432/stable29

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick ca07f155

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/2432/stable29

Error: Failed to create pull request: Validation Failed: {"resource":"PullRequest","code":"custom","message":"A pull request already exists for nextcloud:backport/2432/stable29."}


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@skjnldsv skjnldsv removed the backport-request Pending backport by the backport-bot label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug Something isn't working feedback-requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants