Now cdn_relative_path in lib/global_path.rb looks like this.
module GlobalPath
def path(p)
"#{GlobalSetting.relative_url_root}#{p}"
end
def cdn_path(p)
GlobalSetting.cdn_url.blank? ? p : "#{GlobalSetting.cdn_url}#{path(p)}"
end
def upload_cdn_path(p)
if SiteSetting.Upload.s3_cdn_url.present?
p = Discourse.store.cdn_url(p)
end
(p =~ /^http/ || p =~ /^\/\//) ? p : cdn_path(p)
end
def cdn_relative_path(path)
if (cdn_url = GlobalSetting.cdn_url).present?
URI.parse(cdn_url).path + path
else
path
end
end
As you can see, both cdn_path and upload_cdn_path eventually call the path method which makes sure that the subfolder is being prefixed. However, cdn_relative_path does not call the path method, it just returns its parameter (called… path).
BTW I think cdn_path needs to return path(p) in the middle part of the ternary as well?
@david has fussed with this in the past, but yeah getting the paths right for CDN + subfolder is not easy. I am open to a PR that fixes it provided this is very targeted at your magic combo and does not regress any places that work now.
@sam Haben wir Lösungen für dieses Problem mit einer falschen Source Map? Ich habe das gleiche Problem bei der Installation in einem Unterordner und mit Fastly CDN.
Ja, ich habe in den letzten Wochen eine Reihe von Verbesserungen an Source Maps vorgenommen, die sowohl für ‘Legacy’- als auch für Ember-CLI-Pipelines gelten.
Ich habe gerade eine unserer gehosteten Unterordner-Websites auf tests-passed überprüft, und die Dinge scheinen viel besser zu funktionieren