mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-27 07:25:16 +00:00
Fix: close the uploaded logo image with a context manager when sanitizing
This commit is contained in:
1 parent
f775b94cd6
commit
8c19dcd412
1 file changed
+1
-4
@@ -296,9 +296,8 @@ class ApplicationConfigurationSerializer(
|
||||
return super().update(instance, validated_data)
|
||||
|
||||
def _sanitize_raster_image(self, file: UploadedFile) -> UploadedFile:
|
||||
try:
|
||||
with Image.open(file) as image:
|
||||
data = BytesIO()
|
||||
image = Image.open(file)
|
||||
image.save(data, format=image.format)
|
||||
data.seek(0)
|
||||
|
||||
@@ -310,8 +309,6 @@ class ApplicationConfigurationSerializer(
|
||||
size=data.getbuffer().nbytes,
|
||||
charset=getattr(file, "charset", None),
|
||||
)
|
||||
finally:
|
||||
image.close()
|
||||
|
||||
def validate_app_logo(self, file: UploadedFile):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user