diff --git a/apps/myjobs/app/models/workflow.rb b/apps/myjobs/app/models/workflow.rb index 86b42b7819..c1b79113c1 100644 --- a/apps/myjobs/app/models/workflow.rb +++ b/apps/myjobs/app/models/workflow.rb @@ -145,7 +145,7 @@ def folder_contents }.map { |f| WorkflowFile.new(f, self.staged_dir) }.reject { - |wf| wf.under_dotfile? + |wf| wf.is_dotfile? } else @folder_contents = [] diff --git a/apps/myjobs/app/models/workflow_file.rb b/apps/myjobs/app/models/workflow_file.rb index b046d66fc8..2347a20a4d 100644 --- a/apps/myjobs/app/models/workflow_file.rb +++ b/apps/myjobs/app/models/workflow_file.rb @@ -49,8 +49,8 @@ def relative_path @path.relative_path_from(@staged_dir).to_s end - def under_dotfile? - @path.ascend.to_a.any? { |entry| entry.basename.to_s.start_with?('.') } + def is_dotfile? + @path.basename.to_s.start_with?('.') end def path diff --git a/apps/myjobs/test/models/workflow_file_test.rb b/apps/myjobs/test/models/workflow_file_test.rb index 34dd5293d6..a1d24df0e5 100644 --- a/apps/myjobs/test/models/workflow_file_test.rb +++ b/apps/myjobs/test/models/workflow_file_test.rb @@ -1,10 +1,17 @@ require 'test_helper' class WorkflowFileTest < ActiveSupport::TestCase - test "it recognizes hidden files" do - assert WorkflowFile.new( + test "is dotfile does not detect hidden folders" do + refute WorkflowFile.new( Pathname.new('/home/johrstrom/.wine/drive_c'), Pathname.new('/home/johrstrom/ondemand/and/so/on') - ).under_dotfile? + ).is_dotfile? + end + + test "is dotfile detects hidden files" do + assert WorkflowFile.new( + Pathname.new('/home/johrstrom/wine/.drive_c'), + Pathname.new('/home/johrstrom/ondemand/and/so/on') + ).is_dotfile? end end