refactor: dont use file name from metadata
This commit is contained in:
parent
081cab27b1
commit
5007a2a298
1 changed files with 3 additions and 3 deletions
|
|
@ -53,15 +53,15 @@ async def get_file_metadata(file: BinaryIO, name: Optional[str] = None) -> FileM
|
||||||
except io.UnsupportedOperation as error:
|
except io.UnsupportedOperation as error:
|
||||||
logger.error(f"Error retrieving content hash for file: {file.name} \n{str(error)}\n\n")
|
logger.error(f"Error retrieving content hash for file: {file.name} \n{str(error)}\n\n")
|
||||||
|
|
||||||
file_type = guess_file_type(file, name=name)
|
file_type = guess_file_type(file, name)
|
||||||
|
|
||||||
file_path = getattr(file, "name", None) or getattr(file, "full_name", None)
|
file_path = getattr(file, "name", None) or getattr(file, "full_name", None)
|
||||||
|
|
||||||
if isinstance(file_path, str):
|
if isinstance(file_path, str):
|
||||||
file_name = Path(file_path).stem if file_path else None
|
file_name = Path(file_path).stem if file_path else None
|
||||||
else:
|
else:
|
||||||
# In case file_path does not exist try file_name
|
# In case file_path does not exist or is a integer return None
|
||||||
file_name = name
|
file_name = None
|
||||||
|
|
||||||
# Get file size
|
# Get file size
|
||||||
pos = file.tell() # remember current pointer
|
pos = file.tell() # remember current pointer
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue