From 4bb3d5c4887d24ef7e0cb771645f2b7b50a9105b Mon Sep 17 00:00:00 2001 From: Rahul Triptahi Date: Sat, 22 Jun 2024 01:21:03 +0530 Subject: [PATCH] [community][quick-fix]: changed from blob.path to blob.path.name in 0365BaseLoader. (#22287) Description: file_metadata_ was not getting propagated to returned documents. Changed the lookup key to the name of the blob's path. Changed blob.path key to blob.path.name for metadata_dict key lookup. Documentation: N/A Unit tests: N/A Co-authored-by: ccurme --- .../community/langchain_community/document_loaders/base_o365.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/document_loaders/base_o365.py b/libs/community/langchain_community/document_loaders/base_o365.py index 33a7c5a818a..412076651d1 100644 --- a/libs/community/langchain_community/document_loaders/base_o365.py +++ b/libs/community/langchain_community/document_loaders/base_o365.py @@ -131,7 +131,7 @@ class O365BaseLoader(BaseLoader, BaseModel): if not isinstance(blob.path, PurePath): raise NotImplementedError("Expected blob path to be a PurePath") if blob.path: - file_metadata_ = metadata_dict.get(str(blob.path), {}) + file_metadata_ = metadata_dict.get(str(blob.path.name), {}) blob.metadata.update(file_metadata_) yield blob if self.recursive: