SG-44086 Unzip long paths#1118
Open
carlos-villavicencio-adsk wants to merge 5 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1118 +/- ##
==========================================
+ Coverage 80.11% 80.12% +0.01%
==========================================
Files 203 203
Lines 19549 19561 +12
==========================================
+ Hits 15662 15674 +12
Misses 3887 3887
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
julien-lang
reviewed
Jul 12, 2026
julien-lang
approved these changes
Jul 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates tank.util.zip extraction to better support very long file paths on Windows by introducing a helper that applies the extended-length (\\?\) path prefix during unzip operations.
Changes:
- Added
_to_extended_path()helper to prefix long absolute Windows paths with\\?\to bypassMAX_PATH. - Updated unzip extraction flow to run the computed extraction path through
_to_extended_path()before filesystem operations. - Added unit tests for
_to_extended_path()behavior across platforms.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
python/tank/util/zip.py |
Introduces _to_extended_path() and applies it during per-item extraction to enable long-path handling on Windows. |
tests/util_tests/test_zip.py |
Adds targeted tests to validate _to_extended_path() behavior on Windows and non-Windows platforms. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request enhances the zip extraction utilities to better support long file paths on Windows by introducing handling for extended-length paths. The main changes ensure that file and directory operations during extraction bypass the Windows MAX_PATH limitation.
Windows extended-length path support:
The registry key alone isn't enough - Python's zipfile module doesn't use extended-length paths (\?) automatically. The application itself also needs the longPathAware manifest entry, and the bundled FPT Desktop Python likely doesn't have it.
The real fix needs to be in tk-core's zip utility: prefix to file paths longer than 260 characters on Windows, allowing the code to work with very long paths.
What if FPT desktop enables
longPathAwaremanifest somedayThe fix is still worth keeping for these reasons:
No system config required - The
\\?\approach works on any Windows machine regardless of registry settings or manifest, so users don't need to do anything extra.Defense in depth - The
longPathAware+ registry approach requires both to be true simultaneously. If either is missing (e.g., customer hasn't set the registry key, or the bundled Python doesn't have the manifest), the unzip still fails. The\\?\fix has no such dependencies.Older Python builds - Python 3.6+ includes
longPathAwarein its manifest, but the Python bundled with older FPT Desktop versions may not. The fix works everywhere.Works without reboot - The
\\?\prefix bypasses the limit at the API call level, no reboot or registry change needed.Reference
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry