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

cached files with URL and filename > 260 characters issue and possible solution #4327

Closed
42wim opened this issue Apr 17, 2021 · 1 comment · Fixed by StarsbySea/scoop#1 or #6035
Closed

Comments

@42wim
Copy link

42wim commented Apr 17, 2021

I'm making a manifest for Microsoft Edge and I'm getting the filename too long problem.

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
URL http://msedge.f.tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/c6c3d5da-8cd4-4d17-a52d-9c1b4e9f4ff0?P1=1619294442&P2=404&P3=2&P4=W82qhGeOfF%2bacPu5vkB5FNoZKDucQJEnJ87E0P%2bMAYsiVsgr%2fsrFQA%2fnkdaAVPqIh6m%2b83hjYL%2fCtbpRhTCOXg%3d%3d#/dl.7z is not valid

I don't see anyway to make the URL shorter as this is the full URL, the problem is caused by the cache dir that caches apps with $app $version $url

https://github.com/lukesampson/scoop/blob/3d67b7d37c4a2714e8942724d4677dcbd3678f01/lib/install.ps1#L107

Is there any reason we actually need that URL there ? $app $version should be enough I think ?

If not we can:

  • add the hash instead of the url
  • or make our own hash of $app $version $url

Also I did enable the LongPathsEnabled in the registry and I'm on Windows 10 2004, but this didn't fix the issue.
I'm now running a fork with only $app $version in the cache directory and it works fine.

Any thoughts?
(I can make a PR for this)

StarsbySea added a commit to StarsbySea/scoop that referenced this issue May 5, 2021
Fix: ScoopInstaller#4327
Normally, this function behaves as before when the cache filename is less than 260 characters long.
The modified program is designed to shorten cached filenames while retaining as much complete URL information as possible.
If the filename is greater than or equal to 260 characters in length, it will first attempt to remove everything after the question mark from the URL, and if it is still greater than 260 in length, only the filename in the URL will be retained.
Tested locally and passed.
@Cologler
Copy link

Cologler commented Sep 9, 2022

I suggest using the sha1 of the URL to replace the original URL.

StarsbySea added a commit to StarsbySea/scoop that referenced this issue May 15, 2023
Fix: ScoopInstaller#4327
Normally, this function behaves as before when the cache filename is less than 260 characters long.
The modified program is designed to shorten cached filenames while retaining as much complete URL information as possible.
If the filename is greater than or equal to 260 characters in length, it will first attempt to remove everything after the question mark from the URL, and if it is still greater than 260 in length, only the filename in the URL will be retained.
Tested locally and passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants