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

Error: file name too long #52

Open
balazser opened this issue May 2, 2022 · 2 comments
Open

Error: file name too long #52

balazser opened this issue May 2, 2022 · 2 comments

Comments

@balazser
Copy link

balazser commented May 2, 2022

On Linux using Pget 0.1.1 installed by linuxbrew I'm getting the following error when I download a binary.
How could we fix it?

$ pget https://github.com/42wim/matterbridge/releases/download/v1.25.0/matterbridge-1.25.0-linux-64bit

Error:
  failed to mkdir for download location: mkdir _a44ac081-f540-4721-ae1f-05c2bdd363cf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220502%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220502T142130Z&X-Amz-Expires=300&X-Amz-Signature=db8edd56f819399d6040d92ced71cba3fa7b2d7b94d5cd6255f33d7e092567f5&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=44820350&response-content-disposition=attachment%3B%20filename%3Dmatterbridge-1.25.0-linux-64bit&response-content-type=application%2Foctet-stream.1: file name too long
@septs
Copy link
Contributor

septs commented Oct 19, 2022

I think Pget needs this feature (wget --content-disposition) by default enabled

see https://www.gnu.org/software/wget/manual/wget.html#index-Content_002dDisposition
see https://mdn.io/Content-Disposition

@septs
Copy link
Contributor

septs commented Oct 20, 2022

https://github.com/mirror/wget/blob/aab539bb44b5d7aeb093014c21fd4f4e4e728136/src/http.c#L1221-L1299

on Golang

if mediaType, params, _ := mime.ParseMediaType(resp.Header.Get("Content-Disposition")); mediaType == "attachment" {
    if remoteFilename, ok = params["filename"]; ok {
        task.Filename = remoteFilename
    }
}

CC @Code-Hex

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

No branches or pull requests

2 participants