ui/common/url: Fix multiple-preceeding-slash on pathnames
authorJeremy Kerr <jk@ozlabs.org>
Wed, 6 Mar 2013 05:42:15 +0000 (13:42 +0800)
committerGeoff Levand <geoff@infradead.org>
Wed, 6 Mar 2013 14:06:49 +0000 (06:06 -0800)
Fix the double-slash URL test.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Geoff Levand <geoff@infradead.org>
ui/common/url.c

index 3e6c8dacc19816df8b45ce158bac948a0d214fc0..4e4b9610cd96f1016a6d38aca78e258f5a97452c 100644 (file)
@@ -170,6 +170,11 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str)
                        url->port = NULL;
                        url->host = talloc_strndup(url, p, path - p);
                }
+
+               /* remove multiple leading slashes */
+               for (; *path && *(path+1) == '/'; path++)
+                       ;
+
                url->path = talloc_strdup(url, path);
        }