fix(skills): normalize backslash in ZIP entry names for Windows compatibility#1103
Open
buidackim wants to merge 1 commit intonextlevelbuilder:devfrom
Open
fix(skills): normalize backslash in ZIP entry names for Windows compatibility#1103buidackim wants to merge 1 commit intonextlevelbuilder:devfrom
buidackim wants to merge 1 commit intonextlevelbuilder:devfrom
Conversation
…tibility ZIP archives created on Windows may use backslash (\) as path separator instead of forward slash (/). When extracted on Linux, this causes files like 'scripts\search.py' to be created as a single flat file instead of the proper 'scripts/search.py' directory structure. The ZIP specification (PKZIP APPNOTE) requires forward slashes, but many Windows tools produce non-conforming archives. This adds a strings.ReplaceAll backslash normalization step during skill ZIP extraction to handle this edge case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ZIP archives created on Windows may use backslash (
\) as path separator instead of forward slash (/) in entry names. When these archives are extracted on Linux, the backslash is treated as a literal character in the filename, causing files likescripts\search.pyto be created as a single flat file instead of the properscripts/search.pydirectory structure.This breaks skill execution when skills contain subdirectories (e.g.
scripts/,references/).Root Cause
The ZIP specification (PKZIP APPNOTE) requires forward slashes, but many Windows tools (Python
zipfile, .NETZipArchive, older archivers) produce non-conforming archives with backslashes.The current extraction logic in
skills_upload.gousesfilepath.Clean()which does not convert backslashes to forward slashes on Linux (since\is a valid filename character on Linux).Fix
Added
strings.ReplaceAll(entryName, \, /)normalization beforefilepath.Clean()during skill ZIP extraction. This is a single-line defensive fix that handles the edge case without affecting correctly-formed archives.Testing
scripts\search.pyentryscripts\search.py(flat) → skill execution failsscripts/search.py(subdirectory) → skill works