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

Unable to download .svg external images because invalid file type #3072

Closed
peterbe opened this issue Feb 26, 2021 · 7 comments · Fixed by #3073 or #3173
Closed

Unable to download .svg external images because invalid file type #3072

peterbe opened this issue Feb 26, 2021 · 7 comments · Fixed by #3073 or #3173
Assignees

Comments

@peterbe
Copy link
Contributor

peterbe commented Feb 26, 2021

Steps to reproduce:
Go to http://localhost:3000/en-US/docs/Web/API/WebXR_Device_API/Fundamentals#_flaws
Press "Fix fixable flaws"

Error:

1:48:47 PM server.1     |  Error: No file type could be extracted from https://mdn.mozillademos.org/files/17298/3-degrees-of-freedom-min.svg at all. Probably not going to be a valid image file.
1:48:47 PM server.1     |      at fixFixableFlaws (/Users/peterbe/dev/MOZILLA/MDN/yari/build/flaws.js:589:17)
1:48:47 PM server.1     |      at runMicrotasks (<anonymous>)
1:48:47 PM server.1     |      at processTicksAndRejections (node:internal/process/task_queues:93:5)
1:48:47 PM server.1     |      at async buildDocument (/Users/peterbe/dev/MOZILLA/MDN/yari/build/index.js:396:5)
1:48:47 PM server.1     |      at async /Users/peterbe/dev/MOZILLA/MDN/yari/server/document.js:36:5
1:48:47 PM server.1     |  Error: No file type could be extracted from https://mdn.mozillademos.org/files/17298/3-degrees-of-freedom-min.svg at all. Probably not going to be a valid image file.
1:48:47 PM server.1     |      at fixFixableFlaws (/Users/peterbe/dev/MOZILLA/MDN/yari/build/flaws.js:589:17)
1:48:47 PM server.1     |      at runMicrotasks (<anonymous>)
1:48:47 PM server.1     |      at processTicksAndRejections (node:internal/process/task_queues:93:5)
1:48:47 PM server.1     |      at async buildDocument (/Users/peterbe/dev/MOZILLA/MDN/yari/build/index.js:396:5)
1:48:47 PM server.1     |      at async /Users/peterbe/dev/MOZILLA/MDN/yari/server/document.js:36:5
1:48:47 PM server.1     |  Error in buildDocument(/en-US/docs/Web/API/WebXR_Device_API/Fundamentals) Error: No file type could be extracted from https://mdn.mozillademos.org/files/17298/3-degrees-of-freedom-min.svg at all. Probably not going to be a valid image file.
1:48:47 PM server.1     |      at fixFixableFlaws (/Users/peterbe/dev/MOZILLA/MDN/yari/build/flaws.js:589:17)
1:48:47 PM server.1     |      at runMicrotasks (<anonymous>)
1:48:47 PM server.1     |      at processTicksAndRejections (node:internal/process/task_queues:93:5)
1:48:47 PM server.1     |      at async buildDocument (/Users/peterbe/dev/MOZILLA/MDN/yari/build/index.js:396:5)
1:48:47 PM server.1     |      at async /Users/peterbe/dev/MOZILLA/MDN/yari/server/document.js:36:5

What's wrong with https://mdn.mozillademos.org/files/17298/3-degrees-of-freedom-min.svg ??

@peterbe
Copy link
Contributor Author

peterbe commented Feb 26, 2021

Curious. It worked perfectly fine with https://mdn.mozillademos.org/files/17125/binocular-vision.svg

The difference is that the 3-degrees-of-freedom-min.svg image has its preamble stripped. When you download it with wget the first couple of bytes are:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 918 918">

whereas the binocular-vision.svg one is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0"

I'm going to try to see what happens if you "ignore" that and allow it to be downloaded in either form. Will it render fine?

@peterbe
Copy link
Contributor Author

peterbe commented Feb 26, 2021

Yeah. Renders fine if you ignore the filetype checking stuff (temporarily).
I'll make another exception for SVGs.

@peterbe
Copy link
Contributor Author

peterbe commented Mar 8, 2021

Fix fixable flaws didn't work on http://localhost:3000/en-US/docs/Web/API/EffectTiming/easing#_flaws

@peterbe peterbe reopened this Mar 8, 2021
@peterbe
Copy link
Contributor Author

peterbe commented Mar 8, 2021

Better wait for mdn/content#2943 because I did the other fixable flaws with that document.

@peterbe peterbe closed this as completed Mar 8, 2021
@peterbe
Copy link
Contributor Author

peterbe commented Mar 8, 2021

Oops. I fumbled on the button!

@peterbe peterbe reopened this Mar 8, 2021
@peterbe
Copy link
Contributor Author

peterbe commented Mar 9, 2021

The reason the fixable flaws on http://localhost:3000/en-US/docs/Web/API/EffectTiming/easing#_flaws don't work is because the two external images there are 404'ing. It's just too subtle, and that's unfortunate, but it's not a problem with downloading svgs specifically.

@peterbe peterbe closed this as completed Mar 9, 2021
@peterbe
Copy link
Contributor Author

peterbe commented Mar 9, 2021

@peterbe peterbe reopened this Mar 9, 2021
peterbe added a commit to peterbe/yari that referenced this issue Mar 9, 2021
fiji-flo pushed a commit that referenced this issue Mar 10, 2021
peterbe added a commit to peterbe/yari that referenced this issue Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant