When cURL merges URLs it will cut off the last part if the URL is not
terminated with /.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
}
int pakfire_xfer_set_baseurl(struct pakfire_xfer* xfer, const char* baseurl) {
- return pakfire_string_set(xfer->baseurl, baseurl);
+ int r;
+
+ // Store the URL
+ r = pakfire_string_set(xfer->baseurl, baseurl);
+ if (r < 0)
+ return r;
+
+ // If the URL does not end with a /, let's add it
+ if (!pakfire_string_endswith(xfer->baseurl, "/")) {
+ r = pakfire_string_append(xfer->baseurl, "/");
+ if (r < 0)
+ return r;
+ }
+
+ return 0;
}
const char* pakfire_xfer_get_effective_url(struct pakfire_xfer* xfer) {