No need to str(path) anymore for model item Upload
This commit is contained in:
parent
37f5f5973c
commit
5f04628178
|
@ -191,7 +191,7 @@ class MatrixClient(nio.AsyncClient):
|
|||
size = path.resolve().stat().st_size
|
||||
encrypt = room_id in self.encrypted_rooms
|
||||
|
||||
upload_item = Upload(str(path), total_size=size)
|
||||
upload_item = Upload(path, total_size=size)
|
||||
self.models[Upload, room_id][upload_item.uuid] = upload_item
|
||||
|
||||
url, mime, crypt_dict = await self.upload_file(
|
||||
|
|
|
@ -115,7 +115,7 @@ class UploadStatus(AutoStrEnum):
|
|||
|
||||
@dataclass
|
||||
class Upload(ModelItem):
|
||||
filepath: str = field()
|
||||
filepath: Path = field()
|
||||
status: UploadStatus = UploadStatus.Starting
|
||||
total_size: int = 0
|
||||
uploaded: int = 0
|
||||
|
@ -126,7 +126,7 @@ class Upload(ModelItem):
|
|||
|
||||
def __post_init__(self) -> None:
|
||||
if not self.total_size:
|
||||
self.total_size = Path(self.filepath).resolve().stat().st_size
|
||||
self.total_size = self.filepath.resolve().stat().st_size
|
||||
|
||||
|
||||
def __lt__(self, other: "Upload") -> bool:
|
||||
|
|
Loading…
Reference in New Issue
Block a user