Skip to content

Commit 161afda

Browse files
Update attachment_uploader.rb
Fixes #3657
1 parent c5add8f commit 161afda

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

app/uploaders/attachment_uploader.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@ def image?
2020
false
2121
end
2222

23-
def secure_url
24-
"/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}"
25-
end
23+
unless Gitlab.config.gitlab.relative_url_root.empty?
24+
def secure_url
25+
Gitlab.config.gitlab.relative_url_root + "/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}"
26+
end
27+
else
28+
def secure_url
29+
"/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}"
30+
end
31+
end
2632

2733
def file_storage?
2834
self.class.storage == CarrierWave::Storage::File

0 commit comments

Comments
 (0)