From 3364cb0f2fff12a0a7f5860a08846900bd76c80b Mon Sep 17 00:00:00 2001 From: Braeden Singleton Date: Mon, 18 Aug 2025 16:37:10 -0400 Subject: [PATCH 1/3] change under_dotfile? to is_dotfile? --- apps/myjobs/app/models/workflow.rb | 2 +- apps/myjobs/app/models/workflow_file.rb | 4 ++-- apps/myjobs/test/models/workflow_file_test.rb | 12 +++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) 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..17bf37c790 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.to_s.split('/')[-1].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..157497835f 100644 --- a/apps/myjobs/test/models/workflow_file_test.rb +++ b/apps/myjobs/test/models/workflow_file_test.rb @@ -1,10 +1,16 @@ 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 From 9dd5442cf6705abccc078f950812985c35280d2a Mon Sep 17 00:00:00 2001 From: Braeden Singleton Date: Mon, 18 Aug 2025 16:46:48 -0400 Subject: [PATCH 2/3] correct syntax error --- apps/myjobs/test/models/workflow_file_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/myjobs/test/models/workflow_file_test.rb b/apps/myjobs/test/models/workflow_file_test.rb index 157497835f..a1d24df0e5 100644 --- a/apps/myjobs/test/models/workflow_file_test.rb +++ b/apps/myjobs/test/models/workflow_file_test.rb @@ -12,5 +12,6 @@ class WorkflowFileTest < ActiveSupport::TestCase assert WorkflowFile.new( Pathname.new('/home/johrstrom/wine/.drive_c'), Pathname.new('/home/johrstrom/ondemand/and/so/on') - ).is_dotfile? + ).is_dotfile? + end end From 39eed4f7be1926605f05770769cb651f487ed22c Mon Sep 17 00:00:00 2001 From: Braeden Singleton Date: Tue, 7 Oct 2025 15:05:04 -0400 Subject: [PATCH 3/3] use Pathname#basename --- apps/myjobs/app/models/workflow_file.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/myjobs/app/models/workflow_file.rb b/apps/myjobs/app/models/workflow_file.rb index 17bf37c790..2347a20a4d 100644 --- a/apps/myjobs/app/models/workflow_file.rb +++ b/apps/myjobs/app/models/workflow_file.rb @@ -50,7 +50,7 @@ def relative_path end def is_dotfile? - @path.to_s.split('/')[-1].to_s.start_with?('.') + @path.basename.to_s.start_with?('.') end def path