diff options
Diffstat (limited to 'src/plugins/fs/download.c')
-rw-r--r-- | src/plugins/fs/download.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c index 1f7e4cb7..5a03b657 100644 --- a/src/plugins/fs/download.c +++ b/src/plugins/fs/download.c | |||
@@ -603,16 +603,31 @@ initiateDownload(GtkTreeModel * model, | |||
603 | FREENONNULL(idc_mime); | 603 | FREENONNULL(idc_mime); |
604 | return; | 604 | return; |
605 | } | 605 | } |
606 | if (idc_name == NULL) { | 606 | /* reduce "//" to "/" */ |
607 | if (idc_name != NULL) { | ||
608 | while (strstr(idc_name, "//") != NULL) | ||
609 | memcpy(strstr(idc_name, "//"), | ||
610 | strstr(idc_name, "//") + 1, | ||
611 | strlen(strstr(idc_name, "//"))); | ||
612 | } | ||
613 | /* if no name given or just "/", produce better name */ | ||
614 | if ( (idc_name == NULL) || | ||
615 | (0 == strcmp("/", idc_name)) ) { | ||
607 | #ifdef WINDOWS | 616 | #ifdef WINDOWS |
608 | char * filehash; | 617 | char * filehash; |
609 | 618 | ||
610 | filehash = STRDUP(sdc.uri_name); | 619 | GE_ASSERT(NULL, |
620 | strlen(sdc.uri_name) > strlen(ECRS_URI_PREFIX) + strlen(ECRS_FILE_INFIX)); | ||
621 | FREENONNULL(idc_name); | ||
622 | filehash = STRDUP(&sdc.uri_name[strlen(ECRS_URI_PREFIX) + strlen(ECRS_FILE_INFIX)]); | ||
611 | filehash[16] = 0; | 623 | filehash[16] = 0; |
612 | idc_name = STRDUP(filehash); | 624 | idc_name = STRDUP(filehash); |
613 | FREENONNULL(filehash); | 625 | FREENONNULL(filehash); |
614 | #else | 626 | #else |
615 | idc_name = STRDUP(sdc.uri_name); | 627 | GE_ASSERT(NULL, |
628 | strlen(sdc.uri_name) > strlen(ECRS_URI_PREFIX) + strlen(ECRS_FILE_INFIX)); | ||
629 | FREENONNULL(idc_name); | ||
630 | idc_name = STRDUP(&sdc.uri_name[strlen(ECRS_URI_PREFIX) + strlen(ECRS_FILE_INFIX)]); | ||
616 | #endif | 631 | #endif |
617 | } | 632 | } |
618 | 633 | ||