]> git.ipfire.org Git - pakfire.git/commitdiff
mirror: Ensure paths always have a trailing slash
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 31 Jan 2025 11:57:12 +0000 (11:57 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 31 Jan 2025 11:57:12 +0000 (11:57 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/mirror.c

index 6eeb10515fd5f7d518641dfaf212c81df2ac7469..006ae321d7727fcad04ad6203cf45f3e4c1b9d07 100644 (file)
@@ -68,6 +68,13 @@ int pakfire_mirror_create(struct pakfire_mirror** mirror,
        if (r)
                goto ERROR;
 
+       // If the URL does not end with a /, let's add it
+       if (!pakfire_string_endswith(m->url, "/")) {
+               r = pakfire_string_append(m->url, "/");
+               if (r < 0)
+                       goto ERROR;
+       }
+
        // Set the default retries
        m->retries_left = MIRROR_RETRIES;