Skip to content

Commit 5007a2a

Browse files
committed
refactor: dont use file name from metadata
1 parent 081cab2 commit 5007a2a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cognee/infrastructure/files/utils/get_file_metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ async def get_file_metadata(file: BinaryIO, name: Optional[str] = None) -> FileM
5353
except io.UnsupportedOperation as error:
5454
logger.error(f"Error retrieving content hash for file: {file.name} \n{str(error)}\n\n")
5555

56-
file_type = guess_file_type(file, name=name)
56+
file_type = guess_file_type(file, name)
5757

5858
file_path = getattr(file, "name", None) or getattr(file, "full_name", None)
5959

6060
if isinstance(file_path, str):
6161
file_name = Path(file_path).stem if file_path else None
6262
else:
63-
# In case file_path does not exist try file_name
64-
file_name = name
63+
# In case file_path does not exist or is a integer return None
64+
file_name = None
6565

6666
# Get file size
6767
pos = file.tell() # remember current pointer

0 commit comments

Comments
 (0)