# Caricamento SVG con CR/LF fallisce. Passare a LF funziona

**URL:** https://meta.discourse.org/t/svg-upload-with-cr-lf-fails-change-to-lf-works/120148
**Category:** Bug
**Created:** [12 Giugno 2019, 1:01pm UTC](https://meta.discourse.org/t/svg-upload-with-cr-lf-fails-change-to-lf-works/120148 "2019-06-12T13:01:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://meta.discourse.org/u/EricGT)
#### Post date: [12 Giugno 2019, 1:01pm UTC](https://meta.discourse.org/t/svg-upload-with-cr-lf-fails-change-to-lf-works/120148/1 "2019-06-12T13:01:06Z")

</div>

After reading

# [SVG corruption on download of local images](https://meta.discourse.org/t/svg-corruption-on-download-of-local-images/50081)

> It looks like the process of uploading is breaking the file, somehow. You can run a diff on the original I found on wikipedia: [https://upload.wikimedia.org/wikipedia/en/d/d2/Stitch\_(Lilo\_%26\_Stitch).svg](https://upload.wikimedia.org/wikipedia/en/d/d2/Stitch_%28Lilo_%26_Stitch%29.svg)
> 
> Doing so, it looks like removing linebreaks somehow busted this? The _data_ appears the same, but everything has been moved to a single line rather than being multi-line? Can anyone verify my analysis is correct here?

In testing this idea, copied a simple SVG created with GraphViz on Windows that contained CR (Carriage Return) and LF (Line Feed) and tried an upload. Received the error dialog:

> Sorry, but we couldn’t determine the size of the image. Maybe your image is corrupted?

Then using a text editor ([NotePad++](https://notepad-plus-plus.org/)) used the menu option `View -> Show Symbol -> Show All Characters` to see the line end characters; they were CR/LF. Changed them to LF, saved the file and uploaded. 😃

![ast_transformation_derivative_constant_after%20(linux)](https://global.discourse-cdn.com/meta/original/3X/e/b/eb11683cadcb6aa3e32e6758f5bfdfa96594819f.svg)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [12 Giugno 2019, 1:57pm UTC](https://meta.discourse.org/t/svg-upload-with-cr-lf-fails-change-to-lf-works/120148/2 "2019-06-12T13:57:09Z")

</div>

What exactly are you reporting? The other topic you referenced is very old and out of date so I have deleted it.

---

<div class="post-metadata">

### Author: ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://meta.discourse.org/u/EricGT)
#### Post date: [12 Giugno 2019, 2:04pm UTC](https://meta.discourse.org/t/svg-upload-with-cr-lf-fails-change-to-lf-works/120148/3 "2019-06-12T14:04:50Z")

</div>

> [@codinghorror](#):
>
> What exactly are you reporting?

That uploading an SVG that contains CR/LF will fail with error message. However uploading an SVG that has the CR/LF converted to LF will work.

In other words, if a user sees the error message:

> Sorry, but we couldn’t determine the size of the image. Maybe your image is corrupted?

How are they to know that one of the problems is that they should change the CR/LF to LF

or another option is that

discourse should modify the security scanner/whistleblower to allow CR/LF as valid. 😃
