subhra74 / xdm

Powerfull download accelerator and video downloader
https://xtremedownloadmanager.com/
GNU General Public License v2.0
6.62k stars 1.09k forks source link

fix GetContentDispositionFileName can not correctly handle RFC 6266 specific `filename*` param #1013

Open ttys3 opened 1 year ago

ttys3 commented 1 year ago

resolve https://github.com/subhra74/xdm/issues/1012

fix: fix GetContentDispositionFileName can not correctly handle RFC 6266 specific filename* param

Refs: https://www.rfc-editor.org/rfc/rfc6266#section-4.3

example content-disposition header from Sharepoint storage:

content-disposition: attachment;filename*=utf-8''foo%2Erar;filename="foo.rar"

https://httpwg.org/specs/rfc6266.html#header.field.definition

https://httpwg.org/specs/rfc6266.html#disposition.parameter.filename

https://www.iana.org/assignments/cont-disp/cont-disp.xhtml

according https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives

The parameters filename and filename* differ only in that filename* uses the encoding defined in RFC 5987. When both filename and filename* are present in a single header field value, filename* is preferred over filename when both are understood.

ahmedmoselhi commented 9 months ago

Thnx for this one I confirm it now works like expected