From 8ed85a5cc43b156a64ff98618e4828382728a85b Mon Sep 17 00:00:00 2001
From: Yannick DAYER <yannick.dayer@idiap.ch>
Date: Wed, 18 Oct 2023 14:47:45 +0000
Subject: [PATCH] fix: return value of extracted data is the parent directory.

---
 src/bob/bio/base/database/utils.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/bob/bio/base/database/utils.py b/src/bob/bio/base/database/utils.py
index ca2a92b..17e6bfd 100644
--- a/src/bob/bio/base/database/utils.py
+++ b/src/bob/bio/base/database/utils.py
@@ -599,8 +599,12 @@ def download_file(
                 f"correspond to '{checksum}'."
             )
 
-    # Extract only if the file was re-downloaded
-    if extract and needs_download:
-        local_file = extract_archive(local_file)
+    if extract:
+        # Extract only if the file was re-downloaded
+        if needs_download:
+            local_file = extract_archive(local_file)
+        else:
+            # Mimic the behavior of extract_archive
+            local_file = local_file.parent
 
     return local_file
-- 
GitLab