From 29ef306ae0536de44840ca5acfdf93d84b9a560c Mon Sep 17 00:00:00 2001
From: Dilbarjot Randhawa <46788967+Dilbarjot@users.noreply.github.com>
Date: Sat, 11 Nov 2023 17:16:19 -0500
Subject: [PATCH] fix error that occurs when defining custom_path in
 download_loader. (#8865)

---
 llama_index/readers/download.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/llama_index/readers/download.py b/llama_index/readers/download.py
index 73f666d50a..48ca16446a 100644
--- a/llama_index/readers/download.py
+++ b/llama_index/readers/download.py
@@ -35,11 +35,17 @@ def download_loader(
     Returns:
         A Loader.
     """
+    # Only one of the `custom_dir` or `custom_path` is supported.
+    if custom_path is not None:
+        custom_dir = None
+    else:
+        custom_dir = "llamahub_modules"
+
     reader_cls = download_llama_module(
         loader_class,
         llama_hub_url=loader_hub_url,
         refresh_cache=refresh_cache,
-        custom_dir="llamahub_modules",
+        custom_dir=custom_dir,
         custom_path=custom_path,
         use_gpt_index_import=use_gpt_index_import,
     )
-- 
GitLab