summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAdam Hegyi <ahegyi@gitlab.com>2019-07-11 06:48:50 +0200
committerAdam Hegyi <ahegyi@gitlab.com>2019-07-11 15:52:55 +0200
commitdfe906209e2238b82c84c9fb435498cae2f3d43e (patch)
tree514cf0cd3595fffe175b9cc5eb88dee4881186a8 /app
parent0cd59a756cdee7aac8915f3e96ba4f065e5cbc9c (diff)
downloadgitlab-ce-dfe906209e2238b82c84c9fb435498cae2f3d43e.tar.gz
Queries for Upload should be scoped by model
Diffstat (limited to 'app')
-rw-r--r--app/controllers/concerns/uploads_actions.rb2
-rw-r--r--app/uploaders/records_uploads.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/concerns/uploads_actions.rb b/app/controllers/concerns/uploads_actions.rb
index 59f6d3452a3..f5d35379e10 100644
--- a/app/controllers/concerns/uploads_actions.rb
+++ b/app/controllers/concerns/uploads_actions.rb
@@ -90,7 +90,7 @@ module UploadsActions
return unless uploader = build_uploader
upload_paths = uploader.upload_paths(params[:filename])
- upload = Upload.find_by(uploader: uploader_class.to_s, path: upload_paths)
+ upload = Upload.find_by(model: model, uploader: uploader_class.to_s, path: upload_paths)
upload&.build_uploader
end
# rubocop: enable CodeReuse/ActiveRecord
diff --git a/app/uploaders/records_uploads.rb b/app/uploaders/records_uploads.rb
index 00b51f92b12..d7a859ebd5f 100644
--- a/app/uploaders/records_uploads.rb
+++ b/app/uploaders/records_uploads.rb
@@ -35,7 +35,7 @@ module RecordsUploads
end
def readd_upload
- uploads.where(path: upload_path).delete_all
+ uploads.where(model: model, path: upload_path).delete_all
upload.delete if upload
self.upload = build_upload.tap(&:save!)