2753: Make Collection filenames with existing helper.
authorBrett Smith <brett@curoverse.com>
Mon, 12 May 2014 14:37:55 +0000 (10:37 -0400)
committerBrett Smith <brett@curoverse.com>
Wed, 21 May 2014 16:03:49 +0000 (12:03 -0400)
This is pure refactoring to make the code more consistent.

apps/workbench/app/controllers/collections_controller.rb

index 656c063c9c175ab61664b03d900581feaf3d6184..370c681f074c4c9225d63dd52678734d8773d526 100644 (file)
@@ -185,12 +185,9 @@ class CollectionsController < ApplicationController
   end
 
   def file_in_collection?(collection, filename)
-    def normalized_path(part_list)
-      File.join(part_list).sub(%r{^\./}, '')
-    end
-    target = normalized_path([filename])
+    target = CollectionsHelper.file_path(File.split(filename))
     collection.files.each do |file_spec|
-      return true if (normalized_path(file_spec[0, 2]) == target)
+      return true if (CollectionsHelper.file_path(file_spec) == target)
     end
     false
   end