A platform for community discussion. Free, open, simple.
FIX: Didn't delete upload stub when a new upload is created
Gerhard Schlager235f172b9c13
diff --git a/lib/upload_creator.rb b/lib/upload_creator.rbindex 55f690c635e..5aa02520a20 100644--- a/lib/upload_creator.rb+++ b/lib/upload_creator.rb@@ -196,21 +196,24 @@ class UploadCreatorUpload.generate_digest(@file) != sha1_before_changesend- if @opts[:existing_external_upload_key] && Discourse.store.external?+ store = Discourse.store++ if @opts[:existing_external_upload_key] && store.external?should_move = external_upload_too_big || !upload_changedendif should_move# move the file in the store instead of reuploading- url = Discourse.store.move_existing_stored_upload(+ url = store.move_existing_stored_upload(existing_external_upload_key: @opts[:existing_external_upload_key],upload: @upload)else# store the file and update its urlFile.open(@file.path) do |f|- url = Discourse.store.store_upload(f, @upload)+ url = store.store_upload(f, @upload)end+ store.delete_file(@opts[:existing_external_upload_key]) if @opts[:existing_external_upload_key]endif url.present?