mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 15:25:40 +08:00
FIX: keep to old attachment route
This commit is contained in:
parent
0bd6d79459
commit
b44488b618
@ -29,7 +29,7 @@ class UploadsController < ApplicationController
|
||||
return render_404 unless Discourse.store.internal?
|
||||
return render_404 if SiteSetting.prevent_anons_from_downloading_files && current_user.nil?
|
||||
|
||||
if upload = Upload.find_by(sha1: params[:sha])
|
||||
if upload = Upload.find_by(sha1: params[:sha]) || Upload.find_by(id: params[:id], url: request.fullpath)
|
||||
opts = { filename: upload.original_filename }
|
||||
opts[:disposition] = 'inline' if params[:inline]
|
||||
send_file(Discourse.store.path_for(upload), opts)
|
||||
|
@ -295,6 +295,8 @@ Discourse::Application.routes.draw do
|
||||
get "uploads/:site/:sha" => "uploads#show", constraints: { site: /\w+/, sha: /[a-f0-9]{40}/ }
|
||||
# used to download attachments
|
||||
get "uploads/:site/original/:dir1/:dir2/:sha.:extension" => "uploads#show", constraints: { site: /\w+/, dir1: /[a-f0-9]/, dir2: /[a-f0-9]/, sha: /[a-f0-9]{40}/, extension: /\w{2,}/ }
|
||||
# used to download attachments (old route)
|
||||
get "uploads/:site/:id/:sha.:extension" => "uploads#show", constraints: { site: /\w+/, id: /\d+/, sha: /[a-f0-9]{15}/, extension: /\w{2,}/ }
|
||||
|
||||
get "posts" => "posts#latest"
|
||||
get "posts/by_number/:topic_id/:post_number" => "posts#by_number"
|
||||
|
Loading…
x
Reference in New Issue
Block a user