mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -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(".", "")
|
extension = extension.replace(".", "")
|
||||||
image_path = image_dir.joinpath(f"original.{extension}")
|
image_path = image_dir.joinpath(f"original.{extension}")
|
||||||
|
|
||||||
if isinstance(file_data, bytes):
|
if isinstance(file_data, Path):
|
||||||
with open(image_path, "ab") as f:
|
|
||||||
f.write(file_data)
|
|
||||||
else:
|
|
||||||
shutil.copy2(file_data, image_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)
|
minify.minify_image(image_path)
|
||||||
|
|
||||||
return image_path
|
return image_path
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue