Opkg might receive percent-encoded file:/ URLs from various sources,
e.g. local package lists, user-supplied command line arguments etc.
In order to support such URLs, decode the path component before
trying to invoke file operations on it.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
opkg_msg(NOTICE, "Downloading %s\n", src);
if (str_starts_with(src, "file:")) {
- const char *file_src = src + 5;
+ char *file_src = urldecode_path(src + 5);
opkg_msg(INFO, "Copying %s to %s...", file_src, dest_file_name);
err = file_copy(file_src, dest_file_name);
opkg_msg(INFO, "Done.\n");
free(src_basec);
+ free(file_src);
return err;
}