Wront format of Content-Disposition header on kakaocdn.net

Hello!

Hope this is approprivate forum for reporting issues about Kakao CDN. If not, please guide me to the right place.

While writing application for downloading images from Tistory blogs I’ve noticed that format of the image URLs has changed recently.

Previous format: https://t1.daumcdn.net/cfile/tistory/117C2D335010190624?original
(Can be found e.g. here: https://fortheone.tistory.com/3)

New format: https://k.kakaocdn.net/dn/uhnRH/btqtUjkd9re/P18KTYzrsiiS7qimPPui2K/img.jpg?attach=1&nm=HappyIreneDay2019.jpg
(Can be found e.g. here: https://farbutnear0305.tistory.com/64)

Old version of links return Content-Disposition header in the following form:

$ curl -sI 'https://t1.daumcdn.net/cfile/tistory/117C2D335010190624?original' | grep -i disposition
content-disposition: inline; filename="DSC_7817.jpg"; filename*=UTF-8''DSC_7817.jpg

New version of links return Content-Disposition in this form:

$ curl -sI 'https://k.kakaocdn.net/dn/uhnRH/btqtUjkd9re/P18KTYzrsiiS7qimPPui2K/img.jpg?attach=1&nm=HappyIreneDay2019.jpg' | grep -i disposition
Content-Disposition: attachment; filename="HappyIreneDay2019.jpg"; filename*="UTF-8''HappyIreneDay2019.jpg"

Note the additional quotes in UTF-8 filename.

For some reason the library I’m using to parse that header rejected the new form. After some investigation it turned out those extra quotes violate RFC.

See: https://tools.ietf.org/html/rfc6266#section-4.1
And: https://tools.ietf.org/html/rfc5987#section-3.2.1
Grammar for the UTF-8 filename is:

filename-parm = "filename" "=" value
              | "filename*" "=" ext-value
ext-value     = charset  "'" [ language ] "'" value-chars
value-chars   = *( pct-encoded / attr-char )

No quotes around ext-value are possible. The old form (at daumcdn) is correct but the new one is not.

So, my question is, would you be so kind to fix that? Thanks.

Thank you for your report.

I will guide to the Tistory team as follows.

curl -sI ‘https://k.kakaocdn.net/dn/uhnRH/btqtUjkd9re/P18KTYzrsiiS7qimPPui2K/HappyIreneDay2019.jpg?attach=1&knm=img.jpg

1개의 좋아요

Thanks for the quick reply.

https://k.kakaocdn.net/dn/uhnRH/btqtUjkd9re/P18KTYzrsiiS7qimPPui2K/HappyIreneDay2019.jpg?knm=img.jpg

would work fine for my needs!

Just a little nitpick,

$ curl -sI 'https://k.kakaocdn.net/dn/uhnRH/btqtUjkd9re/P18KTYzrsiiS7qimPPui2K/HappyIreneDay2019.jpg?attach=1&knm=img.jpg' | grep -i disposition 
Content-Disposition: attachment;

I believe that semicolon at the end is not allowed, see

 content-disposition = "Content-Disposition" ":"
                        disposition-type *( ";" disposition-parm )

I.e. disposition params are splitted by semicolons but no extra semicolons are possible.

Either way, in my application I can use URLs without attach=1 and that works fine.