mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add script for preprocessing uploads as part of a migration
This script preprocesses all uploads within a intermediate DB (output of converters) and uploads those files to S3. It does the same for optimized images. This speeds up migrations when you have to run them multiple times, because you only have to preprocess and upload the files once. This script is very hacky and mostly undocumented for now. That will change in the future.
This commit is contained in:
committed by
Gerhard Schlager
parent
1cb600270e
commit
d725b3ca9e
@@ -192,7 +192,9 @@ class OptimizedImage < ActiveRecord::Base
|
||||
extension = File.extname(opts[:filename] || ext_path || path)[1..-1]
|
||||
end
|
||||
|
||||
raise Discourse::InvalidAccess if !extension || !extension.match?(IM_DECODERS)
|
||||
if !extension || !extension.match?(IM_DECODERS)
|
||||
raise Discourse::InvalidAccess.new("Unsupported extension: #{extension}")
|
||||
end
|
||||
"#{extension}:#{path}"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user