diff options
author | Christian Grothoff <christian@grothoff.org> | 2006-12-23 01:53:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2006-12-23 01:53:19 +0000 |
commit | f446005bc8c949219e225e2b800b8d1dc7a2e76f (patch) | |
tree | 3de02f017102048ca10d8312bea33034307aab9a | |
parent | d679328a35d349ce58f23f4611d61ff89464e84f (diff) | |
download | gnunet-gtk-f446005bc8c949219e225e2b800b8d1dc7a2e76f.tar.gz gnunet-gtk-f446005bc8c949219e225e2b800b8d1dc7a2e76f.zip |
fixing mantis 1159
-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 | ||