mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:54:31 +08:00
f43c0a5d85
When uploading an image as a site setting, we need to return the "raw" URL, otherwise
when saving the site setting, the upload won't be looked up properly.
Follow-up-to: f11363d446
22 lines
558 B
Ruby
22 lines
558 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
|
|
object.for_site_setting ? object.url : UrlHelper.cook_url(object.url, secure: SiteSetting.secure_media? && object.secure)
|
|
end
|
|
end
|