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(isDataURI): fix dataURI mediaType format #1916

Merged
merged 3 commits into from
Apr 22, 2022

Conversation

temoffey
Copy link
Contributor

fix(isDataURI): fix dataURI mediaType format

The readAsDataURL method MDN generates a dot mediaType for some file formats (.docx - application/vnd.openxmlformats-officedocument.wordprocessingml.document, . xlsx - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet).
I extended the mediaType validation pattern to be compatible with readAsDataURL.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)

@codecov
Copy link

codecov bot commented Jan 28, 2022

Codecov Report

Merging #1916 (ca0be0b) into master (f055c11) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1916   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          102       102           
  Lines         2072      2072           
  Branches       472       472           
=========================================
  Hits          2072      2072           
Impacted Files Coverage Δ
src/lib/isDataURI.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f055c11...ca0be0b. Read the comment docs.

@@ -10151,6 +10151,7 @@ describe('Validators', () => {
' data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E',
'data:,A%20brief%20note',
'data:text/html;charset=US-ASCII,%3Ch1%3EHello!%3C%2Fh1%3E',
'data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,dGVzdC5kb2N4'
Copy link
Member

Choose a reason for hiding this comment

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

Add a comma to the end of the line here and then tests should pass

Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for your contrib 🎉

// And sorry for the delay in reviewing this.

@profnandaa profnandaa merged commit 066869c into validatorjs:master Apr 22, 2022
@temoffey temoffey deleted the dataURI-mediaType-format branch June 17, 2022 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants