diff options
| author | Jo-Philipp Wich | 2017-12-07 13:23:45 +0000 |
|---|---|---|
| committer | Jo-Philipp Wich | 2017-12-07 16:59:44 +0000 |
| commit | 3b417b9f41b4ceb5912d82f867dd5534e5675b5c (patch) | |
| tree | 6e3fe889befc33743e8017aff01eb72fa068a4c0 | |
| parent | 71c27cb3aee45ba22d3c7806401baf8a0dee3d94 (diff) | |
| download | opkg-lede-3b417b9f41b4ceb5912d82f867dd5534e5675b5c.tar.gz | |
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 <jo@mein.io>
| -rw-r--r-- | libopkg/opkg_download.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |