Chrome and MS Edge truncating filename in from Content-Disposition header

115 Views Asked by At

I have a file saved with a long filename that I'm trying to download from where it's stored on the server. The filename is 254 characters long. When I download the file from Postman, it pulls back the whole filename in both the header and when it tries to save it (all 254 characters). The filename is stupid for testing: bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob123456_bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob123456_bob1234567bob1234567bob1234567bob1234567bob1234567.txt

When I download it via Chrome, it shortens the filename to 177 characters. bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob123456_bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob.txt

When I download it via Edge, it shortens the filename to 217 characters. bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob123456_bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob123456_bob1234567bob.txt

In my Angular application, I'm download it using window.open(<PATH>). I'm able to type in the rest of the characters, but I just don't get why it's shortening the filename when there are no bad special characters. To test out the download in Chrome and Edge, I'm hitting the url directly which makes it hard to see the returned headers. But in Postman, I can see the full filename in the Content-Disposition header: attachment;filename=bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob123456_bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob1234567bob123456_bob1234567bob1234567bob1234567bob1234567bob1234567.txt

Is there something wrong with my header? Or does anyone have an idea about what to do to get the full filename I expect?

0

There are 0 best solutions below