[Bug] Images from URL return "invalid URL" if URL contains extra arguments.
Bug Description
https://images.pexels.com/photos/732444/pexels-photo-732444.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2
Take the above image URL from pexels. It'll open in a browser tab just fine, and is the result of copying the link to an image on the site. However, in Appflowy the image doesn't apply as the URL is "invalid". Removing the arguments makes the image work fine.
How to Reproduce
Copy an image from pexels, unsplash, etc. using "copy link to image" or "copy image url" in your browser.
Example: https://images.pexels.com/photos/732444/pexels-photo-732444.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2
Attempt to set it as your document's cover photo with the image from URL feature:
Expected Behavior
Image is detected and loaded.
Operating System
Windows
AppFlowy Version(s)
0.3.5
Screenshots
As above.
Additional Context
Possibly failing because the Uri parser is expecting an image file extension such as .jpg? We had some issues with this on our own apps and found that making a get request to the URI and parsing the returned content-type in the response header was a good indicator of whether the link contained the document type we were expecting.
@MayurSMahajan I want to work on this please assign it to me.
Assigned. Have fun !
It is a kind of SQL injection to be exact I am working on the uri parser for it to just expect img extensions and ignore the extra attributes.
@DevaanshPathak , still working on this? need help?
@annieappflowy I was working on it until yesterday but am unable to find a fix. Working on open source code is not as easy as it sounds.
Since this issue was created, a lot has changed for the document cover, and I can't reproduce on MacOS anymore.
I'm going to close this for now, we can reopen or create a new issue if still needed.