FIX: uploading an image as a site setting

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
This commit is contained in:
Régis Hanol
2020-07-03 13:23:10 +02:00
parent a9c703c230
commit f43c0a5d85
3 changed files with 10 additions and 4 deletions
+7
View File
@@ -42,6 +42,13 @@ describe UploadsController do
expect(Jobs::CreateAvatarThumbnails.jobs.size).to eq(1)
end
it 'returns "raw" url for site settings' do
set_cdn_url "https://awesome.com"
post "/uploads.json", params: { file: logo, type: "site_setting", for_site_setting: "true" }
expect(response.status).to eq 200
expect(response.parsed_body["url"]).to start_with("/uploads/default/")
end
it 'returns cdn url' do
set_cdn_url "https://awesome.com"
post "/uploads.json", params: { file: logo, type: "composer" }