You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When fetching pictures from URLs like https://graph.facebook.com/xxxxxxxxxxx/picture?type=normal Arc generates a temporary filename before fetching the file and being redirected. This results in storing a file without extension that won't pass any validate/1 function checking for .jpg:
%Arc.File{binary: nil,file_name: "picture",# Filename doesn't have extensionpath: "/tmp/O6SQYBCY6ER62AB6SRO72B2RVKXDEGZX"}
Though HTTPoison doesn't allows us to access redirected URL yet (seet this issue), there's still something we can do.
HTTPoison response for previous URL looks like this:
%HTTPoison.Response{body: <<...>>,headers: [{"Last-Modified","Wed, 14 Jun 2017 00:42:01 GMT"},{"Content-Type","image/jpeg"},# <= We could use this{"Timing-Allow-Origin","*"},{"Access-Control-Allow-Origin","*"},{"Expires","Thu, 16 Nov 2017 19:58:43 GMT"},{"Cache-Control","max-age=1209600, no-transform"},{"Date","Thu, 02 Nov 2017 20:27:53 GMT"},{"Connection","keep-alive"},{"Content-Length","3228"}],status_code: 200}
We could pattern match the {"Content-Type", "image/jpeg"} header to manually add extension to the file if missing after fetching.
Please tell me what you think of this solution so I can start working on a pull request.
The text was updated successfully, but these errors were encountered:
When fetching pictures from URLs like
https://graph.facebook.com/xxxxxxxxxxx/picture?type=normal
Arc generates a temporary filename before fetching the file and being redirected. This results in storing a file without extension that won't pass anyvalidate/1
function checking for.jpg
:Though
HTTPoison
doesn't allows us to access redirected URL yet (seet this issue), there's still something we can do.HTTPoison
response for previous URL looks like this:We could pattern match the
{"Content-Type", "image/jpeg"}
header to manually add extension to the file if missing after fetching.Please tell me what you think of this solution so I can start working on a pull request.
The text was updated successfully, but these errors were encountered: