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

On IOS, you can select any picture from library #57

Open
Nino678190 opened this issue Nov 10, 2024 · 4 comments
Open

On IOS, you can select any picture from library #57

Nino678190 opened this issue Nov 10, 2024 · 4 comments

Comments

@Nino678190
Copy link

When you select a picture from the library you just get a bunch of non sense. Maybe add a check on server side if the uploaded file is svg? While trying to convert, nothing happens. Maybe a Error Message would be good.

@Inferus
Copy link

Inferus commented Nov 10, 2024

@Nino678190 why would one want to convert an svg from ios device? If even so, I wouldn't use library for that since as far as I know its not possible to have svgs in ios library. Files of ios would be a solution for this problem.

Error message for wrong file extesion however would be quite useful

@Nino678190
Copy link
Author

@Inferus I don't know if you can deactivate it, that you can remove the option of for the gallery on IPhone and Ipadsz

@AbrahamX3
Copy link

Interesting, I actually added a PR yesterday for file validation which also gives you a toast error, you can check it out here #36, it should help by telling you that you selected a wrong file type

@avanavana
Copy link

I almost opened an issue for this exact thing—idk if I have time for a PR. But the issue is that you can upload svgs on iOS devices (idk if this is an android or other mobile device issue as well), through the file browser, which is one of the three options that iOS offers.

I do these sorts of things all the time on iOS, and an svg to png converter would be particularly useful on iOS devices specifically because you can’t save or edit svg files in most apps (note that I also considered opening a PR to add an “or, paste URL, base64-encoded string, or SVG code here” field under the file upload.

AFAIK there is no way to disable either the “select from photo library” or “take a photo” options except by limiting the “accepts” attribute to non-image MIME formats, of which svg is unfortunately a type.

There has to be at least server-side validation of the svg format. On the client, you could check the extension before sending it over the wire, but extensions can lie and not all svg files have extensions. However, I am pretty sure you can at least check the MIME type using ’FileReader` on the client.

This isn’t just an issue of generating a nonsense string instead of showing the image (and making the whole app useless to users who do it, not even displaying an error), it actually slows down the rendering of the page a huge amount because the string generated from the raster image data is massive. At least as far as I can tell without being able to intercept network requests on my iPad, the client does not allow upload to the server and attempt conversion when the input is nonsense from the iOS photos library or camera.

But consider that literally 2/3 of all internet traffic these days is from mobile devices…

IMG_0261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants