gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4017 - gnunet-gtk/src/plugins/fs


From: grothoff
Subject: [GNUnet-SVN] r4017 - gnunet-gtk/src/plugins/fs
Date: Fri, 22 Dec 2006 17:53:20 -0800 (PST)

Author: grothoff
Date: 2006-12-22 17:53:19 -0800 (Fri, 22 Dec 2006)
New Revision: 4017

Modified:
   gnunet-gtk/src/plugins/fs/download.c
Log:
fixing mantis 1159

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2006-12-23 01:19:07 UTC (rev 
4016)
+++ gnunet-gtk/src/plugins/fs/download.c        2006-12-23 01:53:19 UTC (rev 
4017)
@@ -603,16 +603,31 @@
     FREENONNULL(idc_mime);
     return;
   }
-  if (idc_name == NULL) {
+  /* reduce "//" to "/" */
+  if (idc_name != NULL) {
+    while (strstr(idc_name, "//") != NULL) 
+      memcpy(strstr(idc_name, "//"),
+            strstr(idc_name, "//") + 1,
+            strlen(strstr(idc_name, "//")));
+  }
+  /* if no name given or just "/", produce better name */
+  if ( (idc_name == NULL) ||
+       (0 == strcmp("/", idc_name)) ) {
 #ifdef WINDOWS
     char * filehash;
 
-    filehash = STRDUP(sdc.uri_name);
+    GE_ASSERT(NULL, 
+             strlen(sdc.uri_name) > strlen(ECRS_URI_PREFIX) + 
strlen(ECRS_FILE_INFIX));
+    FREENONNULL(idc_name);
+    filehash = STRDUP(&sdc.uri_name[strlen(ECRS_URI_PREFIX) + 
strlen(ECRS_FILE_INFIX)]);
     filehash[16] = 0;
     idc_name = STRDUP(filehash);
     FREENONNULL(filehash);
 #else
-    idc_name = STRDUP(sdc.uri_name);
+    GE_ASSERT(NULL, 
+             strlen(sdc.uri_name) > strlen(ECRS_URI_PREFIX) + 
strlen(ECRS_FILE_INFIX));
+    FREENONNULL(idc_name);
+    idc_name = STRDUP(&sdc.uri_name[strlen(ECRS_URI_PREFIX) + 
strlen(ECRS_FILE_INFIX)]);
 #endif
   }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]