After download, alpm_fetch_pkgurl uses payload->destfile_name
and payload->tempfile_name in order to find the downloaded file path.
Those fields are not set if a custom fetch callback is defined.
Use filecache_find_url instead, like in the beginning of the function.

---
 lib/libalpm/dload.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 6f33451a..d45c7707 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -1007,16 +1007,11 @@ int SYMEXPORT alpm_fetch_pkgurl(alpm_handle_t *handle, 
const alpm_list_t *urls,
                        EVENT(handle, &event);
                }
 -              for(i = payloads; i; i = i->next) {
-                       struct dload_payload *payload = i->data;
-                       char *filepath;
+               for(i = urls; i; i = i->next) {
+                       char *url = i->data;
 -                      if(payload->destfile_name) {
-                               const char *filename = 
mbasename(payload->destfile_name);
-                               filepath = _alpm_filecache_find(handle, 
filename);
-                       } else {
-                               STRDUP(filepath, payload->tempfile_name, 
GOTO_ERR(handle, ALPM_ERR_MEMORY, err));
-                       }
+                       /* attempt again to find the file in our pkgcache */
+                       char *filepath = filecache_find_url(handle, url);
                        if(filepath) {
                                alpm_list_append(fetched, filepath);
                        } else {
--
2.31.1

Reply via email to