mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Videos and audio files were not associated to the post.
This commit is contained in:
@@ -230,6 +230,12 @@ class Upload < ActiveRecord::Base
|
||||
url = url.sub(Discourse.asset_host, "") if Discourse.asset_host.present?
|
||||
# when using s3, we need to replace with the absolute base url
|
||||
url = url.sub(SiteSetting.s3_cdn_url, Discourse.store.absolute_base_url) if SiteSetting.s3_cdn_url.present?
|
||||
|
||||
# always try to get the path
|
||||
if (uri = URI(url)).scheme
|
||||
url = uri.path
|
||||
end
|
||||
|
||||
Upload.find_by(url: url)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user