diff --git a/src/python/matrix_client.py b/src/python/matrix_client.py index 96561453..4908b777 100644 --- a/src/python/matrix_client.py +++ b/src/python/matrix_client.py @@ -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( diff --git a/src/python/models/items.py b/src/python/models/items.py index 102f7882..091387a3 100644 --- a/src/python/models/items.py +++ b/src/python/models/items.py @@ -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: