简体   繁体   中英

Firefox removes extension on files when specific download folder is set on options

I'm having a problem downloading files on Firefox 62.0.2 (64-bit) or Firefox Developer Edition 63.0b9 (64-bit) . On Internet Explorer works fine.

I've an admin panel with two buttons to download PDF's. When I click the buttons download pop-up shows and tell me to open the file or save it (and recognize the file as a PDF file). If I choose to open it it opens, but if I've set in the options to save the files on a specific folder, the file is saved with no extension. But if I've set on the options to specify the folder to download everytime, the file it's saved with the extension.

Here you can see the pop-up when it opens:

在此处输入图片说明

Then, If I've set on options download always to a specific folder:

在此处输入图片说明

But if I've set on the options to specify a folder everytime I download a file:

在此处输入图片说明

在此处输入图片说明

The file it's saved with the extension. On the code I've set the headers:

response.setHeader("Content-Type:", "application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=\"desglose.pdf\"");

The URL to access to this resource it's:

@GetMapping(value = "/{id}/desglose")
@Secured(AuthoritiesConstants.ADMIN)

And after read this link Firefox cuts extension on files I don't know where it's my mistake. What I'm doing wrong?

Regards.

Ok, while reading the code after had copied here the lines, I noticed that after the function in other class there was a line with:

response.setHeader("Content-Disposition", "attachment");

which was overriding the value:

response.setHeader("Content-Disposition", "attachment; filename=\"desglose.pdf\"");

and was causing the problem. After remove the line response.setHeader("Content-Disposition", "attachment"); the downloads work fine.

Regards!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM