mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 22:26:30 +08:00
260bb6f073
Currently it is displaying non-cdn urls in the composer preview.
23 lines
585 B
Ruby
23 lines
585 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UploadSerializer < ApplicationSerializer
|
|
attributes :id,
|
|
:url,
|
|
:original_filename,
|
|
:filesize,
|
|
:width,
|
|
:height,
|
|
:thumbnail_width,
|
|
:thumbnail_height,
|
|
:extension,
|
|
:short_url,
|
|
:short_path,
|
|
:retain_hours,
|
|
:human_filesize
|
|
|
|
def url
|
|
return Discourse.store.cdn_url(object.url) if !object.secure || !SiteSetting.secure_media?
|
|
UrlHelper.cook_url(object.url, secure: object.secure)
|
|
end
|
|
end
|