diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2013-09-01 13:58:23 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2013-09-01 13:58:23 +0000 |
commit | c24f80f50cf07743989c08fb27fe69490341fcc9 (patch) | |
tree | b6fa32b5d27f2a0dfef451afc014d4d6a3e38ce8 /src/htsname.c | |
parent | 8b7c561b9fa09f5a2cc1cbf85eb1870c4ec1b7de (diff) |
Fixed content-disposition NOT taken in account (Stephan Matthiesen) except when updating/continuing.
Diffstat (limited to 'src/htsname.c')
-rw-r--r-- | src/htsname.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/htsname.c b/src/htsname.c index 0570edf..7a9ae25 100644 --- a/src/htsname.c +++ b/src/htsname.c @@ -444,7 +444,23 @@ int url_savename(char *adr_complete, char *fil_complete, char *save, // note: if savename_delayed is enabled, the naming will be temporary (and slightly invalid!) // note: if we are about to stop (opt->state.stop), back_add() will fail later else if (opt->savename_delayed != 0 && !opt->state.stop) { - if (mime_type != NULL) { + // Check if the file is ready in backing. We basically take the same logic as later. + // FIXME: we should cleanup and factorize this unholy mess + if (headers != NULL && headers->status >= 0) { + if (strnotempty(headers->r.cdispo)) { /* filename given */ + ext_chg = 2; /* change filename */ + strcpybuff(ext, headers->r.cdispo); + } else if (!may_unknown2(opt, headers->r.contenttype, headers->url_fil)) { // on peut patcher à priori? (pas interdit ou pas de type) + char s[16]; + s[0] = '\0'; + give_mimext(s, headers->r.contenttype); // obtenir extension + if (strnotempty(s) > 0) { // on a reconnu l'extension + ext_chg = 1; + strcpybuff(ext, s); + } + } + } + else if (mime_type != NULL) { ext[0] = '\0'; if (*mime_type) { give_mimext(ext, mime_type); |