Cannot access uploaded files


#1

We’re having trouble with accessing uploaded files. We’ve ascertained that the files are uploaded to the server ok, but then when we click on the link to a file in a post the file cannot be downloaded. The browser is blank or if left-click and download, it says the file does not exist.

Uploads go into /var/www/discourse/public/uploads/default/{userid}
Discourse is installed in /var/www/forums

This is the ruby production log entry tarted GET “/uploads/default/1910/28f98987c41789e2.pdf” for {IP address} at 2016-07-07 12:30:17 +0000
Processing by UploadsController#show as PDF
Parameters: {“site”=>“default”, “id”=>“1910”, “sha”=>“28f98987c41789e2”}
Rendered text template (0.0ms)
Completed 404 Not Found in 6ms (Views: 1.3ms | ActiveRecord: 1.0ms)
Started GET “/uploads/default/1910/28f98987c41789e2.pdf” for {IP address} at 2016-07-07 12:30:18 +0000
Processing by UploadsController#show as PDF
Parameters: {“site”=>“default”, “id”=>“1910”, “sha”=>“28f98987c41789e2”}
Rendered text template (0.0ms)
Completed 404 Not Found in 5ms (Views: 0.7ms | ActiveRecord: 1.1ms)


(Felix Freiberger) #2

Are you using the default Docker-based install?


(Daniel Pett) #3

We’re using the docker install, yes. We’ve been running okay for quite a while, but just hadn’t noticed that uploads were failing to be rendered. We’re currently on v1.6.0.beta10 +68 (Probably should say we’re running with Apache2 and not nginx.)


(Felix Freiberger) #4

That could in principle be caused by your Apache configuration. Can you describe your Apache setup in a bit more detail?


(Daniel Pett) #5

Very basic, without the comments etc:

On Ubuntu 14.04. Everything up to date, latest docker_manager etc.


(Sam Saffron) #6

Can you see the uploads on disk? In the /shared/standalone/uploads folder?


(Daniel Pett) #7

Hi Sam, thanks for chipping in. No I only see the uploads on disk go into /var/www/discourse/public/uploads/default/
Assets get rendered fine from the shared folder.


#8

Here’s some more info on his problem. The uploads we can’t access are historical files uploaded to our own server. Recent uploads go into our amazon s3 account and can be accessed no problem.

Our volumes are mounted like this:

  • volume:
    host: /var/discourse/shared/standalone
    guest: /shared
  • volume:
    host: /var/discourse/shared/standalone/log/var-log
    guest: /var/log
  • volume:
    host: /var/www/discourse/public/uploads/default
    guest: /uploads

The uploads are in var/www/discourse/public/uploads/default with a symlink to this directory at /var/www/forums/shared/uploads There is nothing in the /var/www/forums/shared/standalone directory.

The error generated by trying to access any of the files is a nginx 404 error.

We’ve got a config/permissions error somewhere… Any thoughts gratefully received.


(Alex Salvador) #9

I seem to have the same problem as described by @MaryCK :

  • Uploading images works fine, they appear in posts, including animated gifs
  • Uploading txt or pdf seems to work, a link appears in the post, with the correct file size indicated. However :
    • when clicking on the link, a new tab opens but remains blank.
    • when right clicking on the link, it is possible to download, but the resulting file is empty (0 octet).

I run the latest version (v1.7.0.beta6 +54), installed through the default Docker-based install, on a VPS running Ubuntu 16.04 Server 64 bits, with Docker pre-installed (OVH)

I checked that files are properly uploaded on disk :

  • txt and pdf files appear in /var/discourse/shared/standalone/uploads/default/original/1X only
  • png or gif files appear both in /var/discourse/shared/standalone/uploads/default/original/1X and in /var/discourse/shared/standalone/uploads/default/optimized/1X

I checked that the tab opened when clicking on the file link refers to the proper filename :

Tried this with minimal text file, with a pdf, using a linux then a windows machine, same behavior each time…

Has someone an idea what the problem could be ?