mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
fix no image on scrape
This commit is contained in:
parent
803839e3a1
commit
6b730d012c
1 changed files with 5 additions and 4 deletions
|
@ -62,12 +62,13 @@ def write_image(recipe_slug: str, file_data: bytes, extension: str) -> Path:
|
|||
extension = extension.replace(".", "")
|
||||
image_path = image_dir.joinpath(f"original.{extension}")
|
||||
|
||||
if isinstance(file_data, bytes):
|
||||
with open(image_path, "ab") as f:
|
||||
f.write(file_data)
|
||||
else:
|
||||
if isinstance(file_data, Path):
|
||||
shutil.copy2(file_data, image_path)
|
||||
else:
|
||||
with open(image_path, "ab") as f:
|
||||
shutil.copyfileobj(file_data, f)
|
||||
|
||||
print(image_path)
|
||||
minify.minify_image(image_path)
|
||||
|
||||
return image_path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue