Fix extractDir path detection for ZIP scanning

- Extract UUID folder path from URL instead of using getDirectoryFromPath
- Old logic was broken: listLast on path ending with / returned empty string
- This caused the code to go up one level too far

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-02-13 10:32:18 -08:00
parent f9bfbc8960
commit aa447bd009

View file

@ -387,11 +387,9 @@
</cfif> </cfif>
<!--- Scan ALL HTML files in the ZIP for business info ---> <!--- Scan ALL HTML files in the ZIP for business info --->
<cfset extractDir = getDirectoryFromPath(localFilePath)> <!--- Get the extraction directory from the URL (the UUID folder) --->
<!--- Go up one level if we're in a subfolder (e.g., Menu_files) ---> <cfset extractDir = reReplaceNoCase(targetUrl, "https?://[^/]+(/temp/menu-import/[a-f0-9]+/).*", "\1")>
<cfif NOT findNoCase("menu-import", listLast(extractDir, "/\"))> <cfset extractDir = expandPath(extractDir)>
<cfset extractDir = getDirectoryFromPath(left(extractDir, len(extractDir) - 1))>
</cfif>
<cftry> <cftry>
<cfdirectory action="list" directory="#extractDir#" name="allHtmlFiles" filter="*.htm*" recurse="true" type="file"> <cfdirectory action="list" directory="#extractDir#" name="allHtmlFiles" filter="*.htm*" recurse="true" type="file">
<cfset arrayAppend(response.steps, "Found " & allHtmlFiles.recordCount & " HTML files in ZIP")> <cfset arrayAppend(response.steps, "Found " & allHtmlFiles.recordCount & " HTML files in ZIP")>