Fixed edge case where Task#normalize_path wouldn't handle partial matches of correctly

This commit is contained in:
2025-10-24 23:05:04 -05:00
parent d53299e904
commit 5a3f350015

View File

@@ -118,12 +118,14 @@ class W3DHub
constructed_path = base_path
accepted_parts = 0
split_path = path.split("/")
split_path.each do |segment|
Dir.glob("#{constructed_path}/*").each do |part|
next unless "#{constructed_path}/#{segment}".downcase == part.downcase
constructed_path = part
accepted_parts += 1
break if File.file?(constructed_path)
end
@@ -132,6 +134,8 @@ class W3DHub
# Find file if it exists else use provided path as cased
if "#{base_path}/#{path}".length == constructed_path.length
constructed_path
elsif accepted_parts.positive?
"#{constructed_path}/#{split_path[accepted_parts..].join('/')}"
else
"#{base_path}/#{path}" # File doesn't exist, case doesn't matter.
end