question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"thread '<unnamed>' panicked" when transforming invalid SVG

See original GitHub issue

For a particular SVG image which is invalid according to The W3 markup validator, I get the following error:

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Aborted (core dumped)

While I’m not expecting that sharp can successfully transform invalid input, it would be nice if the error would be properly handled.

To reproduce:

const fs = require('fs');
const sharp = require('sharp');
const IMG_PATH = 'invalid.svg';
const transformer = sharp();
const imageStream = fs.createReadStream(IMG_PATH);
imageStream.pipe(transformer);
try {
  transformer.toBuffer(function(err, buffer, info){
    console.log("success");
  })
} catch (e) {
  console.log("Threw handlable error")
}

Link to invalid.svg and a valid SVG which does work (can’t add SVGs to github comments).

I’m using sharp version 0.21.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Ysgorgcommented, Feb 11, 2019

Yes that does work. Looking forward to the release, thank you!

0reactions
lovellcommented, Mar 19, 2019

sharp v0.22.0 now available, providing libvips v8.7.4 and librsvg v2.45.5.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading SVG fails with Cairo "out of memory" error (w ... - GitLab
Hey, I'm getting a crash in rsvg-convert and tools which use librsvg ... rsvg-convert repro.svg thread '<unnamed>' panicked at 'Cairo error ...
Read more >
Jest cannot load svg file - Stack Overflow
svg files from an icon library in node_modules 1. Using jest-transform-stub in the "transform" section of jest.config.js did not work for me, ...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug:1523 - "[IDEA] Offload work by distributing trivial ebuild maintenance to users, introduce a simple stability voting system and have a core team...
Read more >
Platform/Layout/ReleaseNotes/62 - MozillaWiki
bug 1449243 thread '<unnamed>' panicked at 'assertion failed: ... Layout. bug 1165185 Invalidating transformed elements during scrolling.
Read more >
User Manual - rust-analyzer
break-outside-of-loop; inactive-code; incorrect-ident-case; invalid-derive- ... The next thing to check would be panic messages in rust-analyzer's log.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found