diff options
-rw-r--r-- | bcache.c | 9 | ||||
-rw-r--r-- | url.c | 3 | ||||
-rw-r--r-- | url.h | 1 |
3 files changed, 4 insertions, 9 deletions
@@ -57,7 +57,7 @@ static int bcache_path(ACCOUNT *account, const char *mailbox, * if this ever changes, we have a memleak here */ url.path = NULL; - if (url_ciss_tostring (&url, host, sizeof (host), 0) < 0) + if (url_ciss_tostring (&url, host, sizeof (host), U_PATH) < 0) { dprint (1, (debugfile, "bcache_path: URL to string failed\n")); return -1; @@ -65,13 +65,6 @@ static int bcache_path(ACCOUNT *account, const char *mailbox, dprint (3, (debugfile, "bcache_path: URL: '%s'\n", host)); - /* transform URL scheme:// to scheme: */ - for (s = p = host; *s; s++) - /* keep trailing slash */ - if (*s != '/' || *(s + 1) == '\0') - *p++ = *s; - *p = '\0'; - len = snprintf (dst, dstlen-1, "%s/%s%s%s", MessageCachedir, host, NONULL(mailbox), (mailbox && *mailbox && @@ -184,7 +184,8 @@ int url_ciss_tostring (ciss_url_t* ciss, char* dest, size_t len, int flags) if (ciss->host) { - safe_strcat (dest, len, "//"); + if (!(flags & U_PATH)) + safe_strcat (dest, len, "//"); len -= (l = strlen (dest)); dest += l; if (ciss->user) { @@ -16,6 +16,7 @@ typedef enum url_scheme url_scheme_t; #define U_DECODE_PASSWD (1) +#define U_PATH (1 << 1) typedef struct ciss_url { |