Uploads: get rid of same-source existence check
Remove the lines that checked for existing upload with the same source. These lines were breaking replacements in many cases, so we had to always empty the post's source before replacing, and they served no purpose since the md5 check already catches duplicate uploads.
This commit is contained in:
@@ -66,20 +66,6 @@ class UploadService
|
||||
def start!
|
||||
raise NotImplementedError, "No login credentials configured for #{strategy.site_name}." unless strategy.class.enabled?
|
||||
|
||||
if Utils.is_downloadable?(source)
|
||||
if Post.system_tag_match("source:#{canonical_source}").where.not(id: original_post_id).exists?
|
||||
raise ActiveRecord::RecordNotUnique, "A post with source #{canonical_source} already exists"
|
||||
end
|
||||
|
||||
if Upload.where(source: source, status: "completed").exists?
|
||||
raise ActiveRecord::RecordNotUnique, "A completed upload with source #{source} already exists"
|
||||
end
|
||||
|
||||
if Upload.where(source: source).where("status like ?", "error%").exists?
|
||||
raise ActiveRecord::RecordNotUnique, "An errored upload with source #{source} already exists"
|
||||
end
|
||||
end
|
||||
|
||||
params[:rating] ||= "q"
|
||||
params[:tag_string] ||= "tagme"
|
||||
upload = Upload.create!(params)
|
||||
|
||||
Reference in New Issue
Block a user