-
Notifications
You must be signed in to change notification settings - Fork 18
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
Edge cases in Upload #69
Comments
Good call. If you have time, please PR the update. 🙏 |
Going to work on this. Implementing should be easy, testing might be slightly harder and probably will have to use |
All in favour of fixing edge cases. 👍
|
Getting the following error when attempting to upload on: https://imgup.fly.dev/liveview Couldn't upload files to S3. Open an issue on Github and contact the repo owner. New issue: #88 |
# Conflicts: # config/config.exs # config/runtime.exs
…y named bucket env variables. #69
Really not a fan of having mocks for edge cases that we haven't seen in the real world. |
I now realise that it was a mistake for me to apply a The reason It's taken me so long to review the PR is that it covers many things. I've now spent more time on this issue and PR than I have on my own work for the last 2 weeks. |
…dge-cases-#69 # Conflicts: # lib/app_web/controllers/api_controller.ex # test/app_web/api_test.exs
# Conflicts: # test/app_web/api_test.exs
I've spotted some possible errors with the following code:
imgup/lib/app/upload.ex
Lines 23 to 28 in 81de078
{:ok, file_binary} = File.read(image.path)
This will break if
File.read
returns an error,{:errror, reason}
as the match will fail, see https://hexdocs.pm/elixir/1.12/File.html#read/1file_cid = Cid.cid(file_binary)
The
Cid.cid
function returns a string, however the string can represent an error:invalid data type
, see https://hexdocs.pm/excid/Cid.html#cid/1Not an error in itself but I think we can make this a bit more readable:
Also
MIME.extension
can return an empty list, so in this case the file extension would benil
. Do you still want to upload the file if the extension is unknown? If yes maybe the file name should be just thefile_cid
see https://hexdocs.pm/mime/MIME.html#extensions/1-examples
The text was updated successfully, but these errors were encountered: