Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows support] Very long filenames #40

Merged
merged 2 commits into from
May 10, 2021

Conversation

LysandreJik
Copy link
Member

The huggingface_hub downloads files with very long filenames (135 characters). Since these files may be downloaded to any arbitrary folder, the total length of the path may exceed the 260 character limit imposed by some Windows versions, as visible here

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters.

This PR allows identifying if we're running on the Windows platform and if so checks the absolute length of both the lock file and the actual file to be downloaded. If either of the two resulting paths is too long, it concatenates the \\?\ prefix that specifies it is an extended path, which has a limit of 32k+ characters.

Closes #35

@LysandreJik LysandreJik merged commit 5b5a697 into huggingface:main May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue]: Too long file-paths for Windows
1 participant