From: Jo-Philipp Wich Date: Thu, 7 Dec 2017 13:23:45 +0000 (+0100) Subject: opkg_download: decode file:/ URLs X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=commitdiff_plain;h=3b417b9f41b4ceb5912d82f867dd5534e5675b5c opkg_download: decode file:/ URLs 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 --- diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index 8acbc66..51d43b3 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -49,11 +49,12 @@ opkg_download(const char *src, const char *dest_file_name, 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; }