diff options
Diffstat (limited to 'libopkg')
-rw-r--r-- | libopkg/opkg_download.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index b9533aa..a1b8341 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -215,10 +215,23 @@ opkg_download_cache(const char *src, const char *dest_file_name, if (file_exists(cache_location)) opkg_msg(NOTICE, "Copying %s.\n", cache_location); else { - err = opkg_download(src, cache_location, cb, data, 0); - if (err) { - (void) unlink(cache_location); - goto out2; + /* cache file with funky name not found, try simple name */ + free(cache_name); + char *filename = strrchr(dest_file_name,'/'); + if (filename) + cache_name = xstrdup(filename+1); // strip leading '/' + else + cache_name = xstrdup(dest_file_name); + free(cache_location); + sprintf_alloc(&cache_location, "%s/%s", conf->cache, cache_name); + if (file_exists(cache_location)) + opkg_msg(NOTICE, "Copying %s.\n", cache_location); + else { + err = opkg_download(src, cache_location, cb, data); + if (err) { + (void) unlink(cache_location); + goto out2; + } } } |