mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 08:33:39 +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
|