Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DRAFT] fix(core): support multiple base64 RFCs in Artifact serialization#1870

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
greghopkins wants to merge1 commit intoserenity-js:main
base:main
Choose a base branch
Loading
fromgreghopkins:bugfix/support-photographs-with-linebreaks-in-base64

Conversation

@greghopkins
Copy link
Contributor

@greghopkinsgreghopkins commentedAug 23, 2023
edited by gitpod-iobot
Loading

BrowserStack is returning some screenshot data inbase64 with the older RFC 2045 style (see thevariants summary table), which includes mandatory newlines every 76 characters.

More generally, in this style, whitespace (including newline) is ignored/irrelevant:

$ echo "this is my cool string" | base64dGhpcyBpcyBteSBjb29sIHN0cmluZwo=$ echo -e "dGhpcyBpc\\nyBteSBjb29sIH   N0cmluZwo=" | base64 -Dthis is my cool string

@jan-molak I'm not quite sure the best way to suggest to handle this... I see some options:

  1. Sanitize the input strings by removing all whitespace
  2. Modify the regex inlooksLikeBase64Encoded()which is what I started to do in this PR
  3. Something else?

Thoughts?

@greghopkins
Copy link
ContributorAuthor

@jan-molak The main issue with what's proposed here is this assertion:

photo.map(value=>expect(value.toString('base64')).to.equal(photo.base64EncodedValue));

base64EncodedValue is a member variable that includes any extra whitespace.value.toString('base64') produces the "normalized" version that includes no whitespace, failing.

@jan-molak
Copy link
Member

Hello@greghopkins! Nice catch. Hmm, I think I'd be leaning more towards sanitising the input rather than relaxing the constraint.

This would require us to change:

To avoid code duplication we could introduce a protected method in the basePage class likePage.base64Rfc2045ToBase64(...) to sanitise the result ofthis.browser.takeScreenshot(), or add such converter tocore/io instead.

What do you think?

@jan-molakjan-molak marked this pull request as draftAugust 25, 2023 23:35
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@greghopkins@jan-molak

[8]ページ先頭

©2009-2025 Movatter.jp