diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-08-20 15:42:38 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-10-24 18:32:21 +0200 |
| commit | 1fb4e99abe52f98d34339f12940582f2ca51ecb8 (patch) | |
| tree | 8d30e88c649be96dcc19e05d27b77895c2ada899 /ishtar_common/models_imports.py | |
| parent | b98b3004bb1a47674c9595a5d674dc4ba83344c8 (diff) | |
| download | Ishtar-1fb4e99abe52f98d34339f12940582f2ca51ecb8.tar.bz2 Ishtar-1fb4e99abe52f98d34339f12940582f2ca51ecb8.zip | |
🐛 fix unclosed file
Diffstat (limited to 'ishtar_common/models_imports.py')
| -rw-r--r-- | ishtar_common/models_imports.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py index 3ebbb8068..3270edf59 100644 --- a/ishtar_common/models_imports.py +++ b/ishtar_common/models_imports.py @@ -1907,11 +1907,13 @@ class ImportGroup(BaseImport): imports = [] imported_file, imported_images = None, None if self.imported_file: - imported_file = ContentFile(self.imported_file.read()) - imported_file.name = self.imported_file.name.split(os.sep)[-1] + with open(self.imported_file.path, "rb") as imp: + imported_file = ContentFile(imp.read()) + imported_file.name = self.imported_file.name.split(os.sep)[-1] if self.imported_images: - imported_images = ContentFile(self.imported_images.read()) - imported_images.name = self.imported_images.name.split(os.sep)[-1] + with open(self.imported_images.path, "rb") as imp: + imported_images = ContentFile(imp.read()) + imported_images.name = self.imported_images.name.split(os.sep)[-1] for import_type_relation in self.importer_type.importer_types.all(): importer_type = import_type_relation.importer_type |
