Skip to content

PNG Metadata addition is sometimes creating invalid pngs #184

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
stocksr opened this issue Nov 17, 2022 · 4 comments
Closed

PNG Metadata addition is sometimes creating invalid pngs #184

stocksr opened this issue Nov 17, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@stocksr
Copy link

stocksr commented Nov 17, 2022

Describe the bug
With versions of this plugin that add png meta data I am getting

     CypressError: `cy.task('cp-visual-regression-diff-compareImages')` failed with the following error:

> unrecognised content at end of stream

https://on.cypress.io/api/task
<snip>
    Error: unrecognised content at end of stream
        at module.exports.SyncReader.process (C:\src\Avius4\UI\node_modules\pngjs\lib\sync-reader.js:43:11)
        at module.exports (C:\src\Avius4\UI\node_modules\pngjs\lib\parser-sync.js:68:10)
        at Object.read (C:\src\Avius4\UI\node_modules\pngjs\lib\png-sync.js:7:10)
        at compareImagesTask (C:\src\Avius4\UI\node_modules\@frsource\cypress-plugin-visual-regression-diff\src\task.hook.ts:85:3

if I look at the PNG for that test I can see that it is invalid (the metadata tEXt block is after the IEND block )

To Reproduce

  • Update to a current version of this plugin (3.1.5 in this case - but I have not tested other v3 versions)
  • Run with pluginVisualRegressionUpdateImages=true to recreate all the images
  • Run a normal test run
  • see the error

Expected behavior
The generated images should be correct

Please complete the following information:

  • OS and version: Windows 11
  • Browser and version: electron(embedded)
  • Cypress version 11.1

Additional context
I think but am not sure that this only happens on small images
here is an example images
example-pngs.zip

@stocksr stocksr added the bug Something isn't working label Nov 17, 2022
@FRSgit
Copy link
Member

FRSgit commented Nov 18, 2022

Hey @stocksr!

Thanks for the report. I'm looking into this issue, I've also created a bug report on bug tracker of meta-png (your can follow the ticket there as well) as I believe it's an issue with that library.
Let's try to investigate if further.

@FRSgit
Copy link
Member

FRSgit commented Nov 19, 2022

Hey @stocksr!

Just wanted to report that fix have been added to meta-png library, so I have updated this one and released under 3.1.6 - feel free to test it out!

@stocksr
Copy link
Author

stocksr commented Nov 21, 2022

Many thanks - tested 3.1.6 and can confirm that all generated pngs are now valid

@FRSgit
Copy link
Member

FRSgit commented Nov 21, 2022

Okay, closing this one as fixed then 🙂

@FRSgit FRSgit closed this as completed Nov 21, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants