Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-01-23 21:28:26 +0300
committerStan Hu <stanhu@gmail.com>2019-01-23 22:18:00 +0300
commit19f9d998700592be0d40d6727d6e990ef39ada68 (patch)
tree814fa74cc9aaf5e457dcf3ed291dd0515d2f0700 /spec/models/appearance_spec.rb
parent768475bd78420b6ca023c1322bc13c336d688056 (diff)
Fix 500 errors with legacy appearance logos
Prior to GitLab 9.0, attachments were not tracked the `uploads` table, so it was possible that the appearance logos were just stored in the database as a string and mounted via CarrierWave. https://gitlab.com/gitlab-org/gitlab-ce/issues/29240 implemented in GitLab 10.3 was supposed to cover populating the `uploads` table for all attachments, including all the logos from appearances. However, it's possible that didn't work for logos or the `uploads` entry was orphaned. GitLab instances that had a customized logo with no associated `uploads` entry would see Error 500s. The only way to fix this is to delete the `logo` column from the `appearances` table and re-upload the attachment. This change makes things more robust by falling back to the original behavior if the upload is not available. This is a CE backport of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9277. Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/9357
Diffstat (limited to 'spec/models/appearance_spec.rb')
-rw-r--r--spec/models/appearance_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/models/appearance_spec.rb b/spec/models/appearance_spec.rb
index ec2e7d672f0..cc76a2019ec 100644
--- a/spec/models/appearance_spec.rb
+++ b/spec/models/appearance_spec.rb
@@ -36,6 +36,13 @@ describe Appearance do
expect(subject.send("#{logo_type}_path")).to be_nil
end
+ it 'returns the path when the upload has been orphaned' do
+ appearance.send(logo_type).upload.destroy
+ appearance.reload
+
+ expect(appearance.send("#{logo_type}_path")).to eq(expected_path)
+ end
+
it 'returns a local path using the system route' do
expect(appearance.send("#{logo_type}_path")).to eq(expected_path)
end