mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
Add extra protection in Upload#get_from_url
.
In case the extension goes missing from the URL.
This commit is contained in:
@ -177,7 +177,7 @@ class Upload < ActiveRecord::Base
|
||||
end
|
||||
|
||||
return if uri&.path.blank?
|
||||
data = uri.path.match(/(\/original\/\dX[\/\.\w]*\/([a-zA-Z0-9]+)[\.\w]+)/)
|
||||
data = uri.path.match(/(\/original\/\dX[\/\.\w]*\/([a-zA-Z0-9]+)[\.\w]*)/)
|
||||
return if data.blank?
|
||||
sha1 = data[2]
|
||||
upload = nil
|
||||
|
Reference in New Issue
Block a user