Unable to download PDF

Hello Team,

I am using the server local storage for storing the files. I have uploaded a pdf file and it was successfully uploaded in the server and, it’s present at the server as well ( I checked it manually by doing ssh login ).

Screenshot from 2019-12-24 14-44-42

That’s the screenshot of error getting raised when I am trying to download the pdf file.

This is the log of the download event

[discourse_cloud] Started GET "/uploads/short-url/ev4yCeBAtz19YgsTSEkhLMkKrFK.pdf" for 122.168.93.128 at 2019-12-24 09:16:40 +0000
[discourse_cloud] Processing by UploadsController#show_short as PDF
[discourse_cloud]   Parameters: {"base62"=>"ev4yCeBAtz19YgsTSEkhLMkKrFK", "extension"=>"pdf"}
[discourse_cloud] Sent file /home/deploy/discourse_cloud/releases/20191220210316/public/uploads/discourse_cloud/original/1X/65a1a66f4bddc09fbdab830a8c74c7fbe05cca98.pdf (0.2ms)
[discourse_cloud] Completed 200 OK in 11ms (ActiveRecord: 0.0ms)
[discourse_cloud] Started GET "/home/deploy/discourse_cloud/releases/20191220210316/public/uploads/discourse_cloud/original/1X/65a1a66f4bddc09fbdab830a8c74c7fbe05cca98.pdf" for 122.168.93.128 at 2019-12-24 09:16:40 +0000
[discourse_cloud] ActionController::RoutingError (No route matches [GET] "/home/deploy/discourse_cloud/releases/20191220210316/public/uploads/discourse_cloud/original/1X/65a1a66f4bddc09fbdab830a8c74c7fbe05cca98.pdf")
/home/deploy/discourse_cloud/shared/bundle/ruby/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call'
[discourse_cloud]   Rendering exceptions/not_found.html.erb within layouts/no_ember
[discourse_cloud]   Rendered exceptions/not_found.html.erb within layouts/no_ember (0.6ms)
[discourse_cloud]   Rendered layouts/_head.html.erb (1.0ms)
[discourse_cloud]   Rendered common/_discourse_stylesheet.html.erb (0.6ms)
[discourse_cloud]   Rendered application/_header.html.erb (0.1ms)
[discourse_cloud]   Rendering html template
[discourse_cloud]   Rendered html template (0.0ms)

What could be the error ? :-/

If you didn’t upload the file with discourse you will need to change the nginx config inside the container. It’s not set up to server arbitrary files in arbitrary directories.

The screenshot looks like it was uploaded using discourse, but the URL path looks like a tidied short url rather than the real thing?

Can you try uploading that pdf to try.discourse.org and see if it works there? Maybe you have an issue with that specific file?

I guess uploading other types of files works?

Well, I am unable to upload the file without any issues but it’s now allowing me download the file.

I uploaded the file using Discourse message box and it uploaded successfully but I am not able to download it.

Yes @Stephen, I am able to upload the file smoothly using my discourse but, it’s not allowing me to download. :frowning:

Please have a look at this screenshot, It’s having a download button. When I tried click on it, I am not able to download.

That’s the error raised when I tried to download the image using download button. ( Download button probably using send_data ruby function )

I just want to undrestand that this is something wrong with NGINX or any other directories permission related issue.

Thanks

같은 문제를 겪었습니다. PDF 파일은 업로드되지만, 파일을 다운로드하려고 하면 “이 페이지는 존재하지 않습니다” 페이지로 이동합니다!

메타에서 직접 테스트해 보았는데, PDF 파일을 쉽게 업로드하고 다운로드할 수 있었습니다.

업데이트: 몇 가지 변경 사항을 시도해 본 결과, 영어가 아닌 다른 언어와 관련된 Contribute > Bug 문제로 보입니다.

PDF 파일을 영문 파일명으로 다시 생성해야 했습니다(이전에는 파일명에 페르시아 문자가 포함되어 있었습니다). 이후에는 업로드된 파일을 문제 없이 다운로드할 수 있었습니다.

또한, 페르시아 문자가 포함된 파일명의 PDF도 메타에서는 쉽게 업로드하고 다운로드할 수 있었습니다. 따라서 관리자 패널의 인코딩 옵션과 관련이 있을 것으로 추정됩니다.

Hello Team,

Sorry, I am very late here to reply but I fixed my problem by making changes with in the nginx.conf file. It was a very easy fix and was related with the nginx.conf ( And I was trying to fix the core code :smiley: ).

I removed this line from my nginx.conf

 proxy_set_header X-Sendfile-Type X-Accel-Redirect;

That was fix to make the downloading work :slight_smile:

I will try to be frequent from now on :slight_smile:

Thank you,
Ashish P.