2018-07-21 20:39:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-06-25 09:10:26 -04:00
|
|
|
class ImportExportUploader < AttachmentUploader
|
2021-10-19 08:12:07 -04:00
|
|
|
EXTENSION_ALLOWLIST = %w[tar.gz gz].freeze
|
2018-06-25 09:10:26 -04:00
|
|
|
|
2020-02-24 16:09:08 -05:00
|
|
|
def self.workhorse_local_upload_path
|
|
|
|
File.join(options.storage_path, 'uploads', TMP_UPLOAD_PATH)
|
|
|
|
end
|
|
|
|
|
2018-06-25 09:10:26 -04:00
|
|
|
def extension_whitelist
|
2021-10-19 08:12:07 -04:00
|
|
|
EXTENSION_ALLOWLIST
|
2018-06-25 09:10:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def move_to_cache
|
2022-01-24 13:14:42 -05:00
|
|
|
# Exports create temporary files that we can safely move.
|
|
|
|
# Imports may be from project templates that we want to copy.
|
|
|
|
return super if mounted_as == :export_file
|
|
|
|
|
2018-06-25 09:10:26 -04:00
|
|
|
false
|
|
|
|
end
|
2020-04-08 17:09:50 -04:00
|
|
|
|
|
|
|
def work_dir
|
|
|
|
File.join(Settings.shared['path'], 'tmp', 'work')
|
|
|
|
end
|
|
|
|
|
|
|
|
def cache_dir
|
|
|
|
File.join(Settings.shared['path'], 'tmp', 'cache')
|
|
|
|
end
|
2018-06-25 09:10:26 -04:00
|
|
|
end
|