Module: API::Helpers::FileUploadHelpers
- Defined in:
- lib/api/helpers/file_upload_helpers.rb
Instance Method Summary collapse
Instance Method Details
#file_is_valid? ⇒ Boolean
6 7 8 9 |
# File 'lib/api/helpers/file_upload_helpers.rb', line 6 def file_is_valid? filename = params[:file]&.original_filename filename && ImportExportUploader::EXTENSION_ALLOWLIST.include?(File.extname(filename).delete('.')) end |
#validate_file! ⇒ Object
11 12 13 |
# File 'lib/api/helpers/file_upload_helpers.rb', line 11 def validate_file! render_api_error!({ error: _('You need to upload a GitLab project export archive (ending in .gz).') }, 422) unless file_is_valid? end |