FIX: Post#each_upload_url yields incorrect path to block when CDN is enabled.

This commit is contained in:
Guo Xiang Tan
2019-07-31 10:00:52 +08:00
parent 43365a2bf1
commit 8a6ee09008
2 changed files with 34 additions and 7 deletions

View File

@@ -905,7 +905,7 @@ class Post < ActiveRecord::Base
next unless Discourse.store.has_been_uploaded?(src) || (include_local_upload && src =~ /\A\/[^\/]/i)
path = begin
URI(URI.unescape(src))&.path
URI(URI.unescape(GlobalSetting.cdn_url ? src.sub(GlobalSetting.cdn_url, "") : src))&.path
rescue URI::Error
end