gitlab-org--gitlab-foss/app/uploaders/attachment_uploader.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
636 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
2016-08-18 14:31:44 +00:00
class AttachmentUploader < GitlabUploader
include RecordsUploads::Concern
include ObjectStorage::Concern
prepend ObjectStorage::Extension::RecordsUploads
2018-03-02 21:19:17 +00:00
include UploaderHelper
private
2011-10-08 21:36:38 +00:00
def dynamic_segment
File.join(model.class.underscore, mounted_as.to_s, model.id.to_s)
2011-10-08 21:36:38 +00:00
end
def mounted_as
# Geo fails to sync attachments on Note, and LegacyDiffNotes with missing mount_point.
#
# See https://gitlab.com/gitlab-org/gitlab/-/issues/209752 for more details.
if model.class.underscore.include?('note')
super || 'attachment'
else
super
end
end
2011-10-08 21:36:38 +00:00
end