Skip to content

NixOS/Discourse: can't download PDF #142528

@ryantm

Description

@ryantm

Describe the bug

A URL like http://10.33.4.68/uploads/short-url/ulj6Qq2gjDT5uAipgZkwpA3Yrsz.pdf generates the following error log:

Started GET "/uploads/short-url/ulj6Qq2gjDT5uAipgZkwpA3Yrsz.pdf" for 10.33.4.12 at 2021-10-22 08:50:31 -0700
Processing by UploadsController#show_short as PDF
  Parameters: {"base62"=>"ulj6Qq2gjDT5uAipgZkwpA3Yrsz", "extension"=>"pdf"}
Sent file /nix/store/d47ibrh36cyfpqwp3fjzhsvnrg4ycz13-discourse-2.7.5/share/discourse/public/uploads/default/original/1X/d4a9d7c67bbda1560799182d4ecfc878f80d3a67.pdf (0.2ms)
Completed 200 OK in 5ms (ActiveRecord: 0.0ms | Allocations: 2147)
Started GET "/nix/store/d47ibrh36cyfpqwp3fjzhsvnrg4ycz13-discourse-2.7.5/share/discourse/public/uploads/default/original/1X/d4a9d7c67bbda1560799182d4ecfc878f80d3a67.pdf" for 10.33.4.12 at 2021-10-22 08:50:31 -0700
ActionController::RoutingError (No route matches [GET] "/nix/store/d47ibrh36cyfpqwp3fjzhsvnrg4ycz13-discourse-2.7.5/share/discourse/public/uploads/default/original/1X/d4a9d7c67bbda1560799182d4ecfc878f80d3a67.pdf")
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:177:in `call'
  Rendered exceptions/not_found.html.erb within layouts/no_ember (Duration: 0.2ms | Allocations: 114)
  Rendered layout layouts/no_ember.html.erb (Duration: 2.5ms | Allocations: 1620)
  Rendered html template (Duration: 0.0ms | Allocations: 2)

Steps To Reproduce

Steps to reproduce the behavior:

  1. Try to download a file that has been uploaded

Expected behavior

Should download the file

@talyz @dpausp Are you seeing this problem on your non-beta versions of Discourse?

It looks like maybe the X-Accel-Mapping isn't applying and then the request to download a file is getting fed back into Rails.

Metadata

Metadata

Assignees

Labels

0.kind: bugSomething is broken6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions