fix issues with the uploads directory
Hey,
The issue:
The uploads folder missing from this repo is causing issues when trying to upload a picture for the first time on a newly created instance. It seems fairly common since this was talked about 3 times in two days (myself included).
** (exit) an exception was raised:
** (File.CopyError) could not copy from "/tmp/plug-1556/profile_pics-1556362093-6411744059894-2" to "uploads/d7b07d11d55de069747259d52ccf08dd67
d8ece6d5e1ce88247132b316aaf5b6.png": no such file or directory
(elixir) lib/file.ex:780: File.cp!/3
(pleroma) lib/pleroma/uploaders/local.ex:27: Pleroma.Uploaders.Local.put_file/1
(pleroma) lib/pleroma/uploaders/uploader.ex:46: Pleroma.Uploaders.Uploader.put_file/2
(pleroma) lib/pleroma/upload.ex:65: Pleroma.Upload.store/2
(pleroma) lib/pleroma/web/activity_pub/activity_pub.ex:824: Pleroma.Web.ActivityPub.ActivityPub.upload/2
(pleroma) lib/pleroma/web/twitter_api/twitter_api_controller.ex:460: Pleroma.Web.TwitterAPI.Controller.update_avatar/2
(pleroma) lib/pleroma/web/twitter_api/twitter_api_controller.ex:5: Pleroma.Web.TwitterAPI.Controller.action/2
(pleroma) lib/pleroma/web/twitter_api/twitter_api_controller.ex:5: Pleroma.Web.TwitterAPI.Controller.phoenix_controller_pipeline/2
Here are several possible solutions and my stance on them:
- Adding a note in the documentation. (another thing users have to look for)
- Checking if the folder exists in the code and mkdir if that's false. (more code - more to maintain - more that can break)
- This solution, using git to keep that folder and track nothing else than the .gitignore inside.
I don't really know which one is better, but to me it seems like this one is a nice way of doing so.
Demonstration:
Have a good day!