Module: MetricImageUploading

Extended by:
ActiveSupport::Concern
Included in:
AlertManagement::MetricImage
Defined in:
app/models/concerns/metric_image_uploading.rb

Constant Summary collapse

MAX_FILE_SIZE =
1.megabyte.freeze

Instance Method Summary collapse

Instance Method Details

#file_pathObject



29
30
31
32
33
34
35
36
37
38
# File 'app/models/concerns/metric_image_uploading.rb', line 29

def file_path
  @file_path ||= begin
    return file&.url unless file&.upload

    # If we're using a CDN, we need to use the full URL
    asset_host = ActionController::Base.asset_host || Gitlab.config.gitlab.base_url

    Gitlab::Utils.append_path(asset_host, local_path)
  end
end

#filenameObject



25
26
27
# File 'app/models/concerns/metric_image_uploading.rb', line 25

def filename
  @filename ||= file&.filename
end