Iterate through filtered file types instead of all listed files (#6258)

# Iterate through filtered file types instead of all listed files

Fixes https://github.com/hwchase17/langchain/issues/6257

https://github.com/hwchase17/langchain/pull/4926 originally added the
functionality to filter by file type, storing the filtered files in
`_files`

https://github.com/hwchase17/langchain/pull/5220 removed the
functionality when adding code to filter trashed files by using the
`files` variables instead of the `_files` variable.

This PR simply adds the functionality back by using `_files` again.

#### Who can review?

@hwchase17 - project lead
@eyurtsev
This commit is contained in:
Ted 2023-06-18 17:47:58 -07:00 committed by GitHub
parent ba90e3c990
commit 112695e4da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,7 +228,7 @@ class GoogleDriveLoader(BaseLoader, BaseModel):
_files = files _files = files
returns = [] returns = []
for file in files: for file in _files:
if file["trashed"] and not self.load_trashed_files: if file["trashed"] and not self.load_trashed_files:
continue continue
elif file["mimeType"] == "application/vnd.google-apps.document": elif file["mimeType"] == "application/vnd.google-apps.document":