Philipp Hörist pushed to branch master at gajim / gajim
Commits:
e2e40a35 by Philipp Hörist at 2023-01-27T00:32:20+01:00
fix: HTTPUpload: Don’t cache temp path
The cache is on the class for staticmethods and is not reseted
when we create a new instance.
Fixes #11373
- - - - -
1 changed file:
- gajim/common/modules/httpupload.py
Changes:
=====================================
gajim/common/modules/httpupload.py
=====================================
@@ -20,7 +20,6 @@
from typing import cast
from typing import Optional
-import functools
import mimetypes
import os
import tempfile
@@ -368,6 +367,7 @@ def __init__(self,
self._headers: dict[str, str] = {}
self._is_encrypted = False
+ self._temp_path = self._get_temp_path()
@property
def size(self) -> int:
@@ -407,7 +407,7 @@ def path(self) -> Path:
@property
def payload_path(self) -> Path:
if self._encryption is not None:
- return self.get_temp_path()
+ return self._temp_path
return self._path
@property
@@ -427,8 +427,7 @@ def filename(self) -> str:
return self._path.name
@staticmethod
- @functools.cache
- def get_temp_path() -> Path:
+ def _get_temp_path() -> Path:
tempdir = tempfile.gettempdir()
return Path(tempdir) / get_random_string(16)
@@ -442,8 +441,7 @@ def set_finished(self) -> None:
super().set_finished()
def set_encrypted_data(self, data: bytes) -> None:
- temp_path = self.get_temp_path()
- temp_path.write_bytes(data)
+ self._temp_path.write_bytes(data)
self._is_encrypted = True
def get_data(self) -> bytes:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e2e40a351f63bb0b6e24889a227ef83ed8df4ff5
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e2e40a351f63bb0b6e24889a227ef83ed8df4ff5
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits