X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2b27132d13fd72f29dbab2297f0d2dc1c110eed1..d694a717acb2e577afa396aea140e5284b7f763d:/apps/workbench/app/controllers/collections_controller.rb diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb index 02b204f18c..dc9ed43c40 100644 --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@ -326,12 +326,18 @@ class CollectionsController < ApplicationController end arv_coll = Arv::Collection.new(@object.manifest_text) - arv_coll.rename "./"+file_path, new_file_path - if @object.update_attributes manifest_text: arv_coll.manifest_text - show - else + if arv_coll.exist?(new_file_path) + @errors = 'Duplicate file path. Please use a different name.' self.render_error status: 422 + else + arv_coll.rename "./"+file_path, new_file_path + + if @object.update_attributes manifest_text: arv_coll.manifest_text + show + else + self.render_error status: 422 + end end else # Not a file rename; use default