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/?a=commitdiff_plain;h=9f61f7acf3845d2e09675b49fec5d783d57eb780;p=oweals%2Fopkg-lede.git 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 e57d053..c03e82d 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; }