From b29959307635c936ee5e4303c1b43ef95295f14d Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Fri, 31 Oct 2025 11:53:53 -0500 Subject: [PATCH] Fixed a couple edge cases with Task#normalize_path causing failures --- lib/application_manager/task.rb | 9 ++++++--- lib/application_manager/tasks/installer.rb | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/application_manager/task.rb b/lib/application_manager/task.rb index 019ba8e..4f334c4 100644 --- a/lib/application_manager/task.rb +++ b/lib/application_manager/task.rb @@ -117,6 +117,7 @@ class W3DHub return "#{base_path}/#{path}" if W3DHub.windows? # Windows is easy, or annoying, depending how you look at it... constructed_path = base_path + lowercase_full_path = "#{base_path}/#{path}".downcase.strip.freeze accepted_parts = 0 split_path = path.split("/") @@ -124,15 +125,17 @@ class W3DHub Dir.glob("#{constructed_path}/*").each do |part| next unless "#{constructed_path}/#{segment}".downcase == part.downcase + # Handle edge case where a file with the same name is in a higher directory + next if File.file?(part) && part.downcase.strip != lowercase_full_path + constructed_path = part accepted_parts += 1 - - break if File.file?(constructed_path) + break end end # Find file if it exists else use provided path as cased - if "#{base_path}/#{path}".length == constructed_path.length + if constructed_path.downcase.strip == lowercase_full_path constructed_path elsif accepted_parts.positive? "#{constructed_path}/#{split_path[accepted_parts..].join('/')}" diff --git a/lib/application_manager/tasks/installer.rb b/lib/application_manager/tasks/installer.rb index 4c63b3a..dcee2e1 100644 --- a/lib/application_manager/tasks/installer.rb +++ b/lib/application_manager/tasks/installer.rb @@ -53,4 +53,4 @@ class W3DHub end end end -end \ No newline at end of file +end