fix: convert file path to str (#693)
## Description fix int unable find method .split, not sure why its a int ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
This commit is contained in:
parent
ef2bd5c1e3
commit
edea54c5c3
2 changed files with 2 additions and 2 deletions
|
|
@ -21,7 +21,7 @@ def get_file_metadata(file: BinaryIO) -> FileMetadata:
|
|||
file_type = guess_file_type(file)
|
||||
|
||||
file_path = file.name
|
||||
file_name = file_path.split("/")[-1].split(".")[0] if file_path else None
|
||||
file_name = str(file_path).split("/")[-1].split(".")[0] if file_path else None
|
||||
|
||||
return FileMetadata(
|
||||
name=file_name,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ def classify(data: Union[str, BinaryIO], filename: str = None):
|
|||
return TextData(data)
|
||||
|
||||
if isinstance(data, BufferedReader) or isinstance(data, SpooledTemporaryFile):
|
||||
return BinaryData(data, data.name.split("/")[-1] if data.name else filename)
|
||||
return BinaryData(data, str(data.name).split("/")[-1] if data.name else filename)
|
||||
|
||||
raise IngestionError(
|
||||
message=f"Type of data sent to classify(data: Union[str, BinaryIO) not supported: {type(data)}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue