blob: 1652bdab5b871fb1adfba8cdadad16f6e30404b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# frozen_string_literal: true
module Import
module GitlabProjects
module FileAcquisitionStrategies
class FileUpload
include ActiveModel::Validations
validate :uploaded_file
def initialize(params:, current_user: nil)
@params = params
end
def project_params
@project_params ||= @params.slice(:file)
end
def file
@file ||= @params[:file]
end
private
def uploaded_file
return if file.present? && file.is_a?(UploadedFile)
errors.add(:file, 'must be uploaded')
end
end
end
end
end
|