mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
fix: Images Using Wrong Content Type (#4441)
This commit is contained in:
parent
d48320f0a5
commit
f7e595b404
3 changed files with 4 additions and 15 deletions
|
@ -131,7 +131,6 @@ HEALTHCHECK CMD python $MEALIE_HOME/mealie/scripts/healthcheck.py || exit 1
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
# Copy Frontend
|
# Copy Frontend
|
||||||
|
|
||||||
# copying caddy into image
|
|
||||||
ENV STATIC_FILES=/spa/static
|
ENV STATIC_FILES=/spa/static
|
||||||
COPY --from=builder /app/dist ${STATIC_FILES}
|
COPY --from=builder /app/dist ${STATIC_FILES}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,7 @@ from starlette.responses import FileResponse
|
||||||
from mealie.schema.recipe import Recipe
|
from mealie.schema.recipe import Recipe
|
||||||
from mealie.schema.recipe.recipe_timeline_events import RecipeTimelineEventOut
|
from mealie.schema.recipe.recipe_timeline_events import RecipeTimelineEventOut
|
||||||
|
|
||||||
"""
|
router = APIRouter(prefix="/recipes")
|
||||||
These routes are for development only! These assets are served by Caddy when not
|
|
||||||
in development mode. If you make changes, be sure to test the production container.
|
|
||||||
"""
|
|
||||||
|
|
||||||
router = APIRouter(prefix="/recipes", include_in_schema=False)
|
|
||||||
|
|
||||||
|
|
||||||
class ImageType(str, Enum):
|
class ImageType(str, Enum):
|
||||||
|
@ -30,7 +25,7 @@ async def get_recipe_img(recipe_id: str, file_name: ImageType = ImageType.origin
|
||||||
recipe_image = Recipe.directory_from_id(recipe_id).joinpath("images", file_name.value)
|
recipe_image = Recipe.directory_from_id(recipe_id).joinpath("images", file_name.value)
|
||||||
|
|
||||||
if recipe_image.exists():
|
if recipe_image.exists():
|
||||||
return FileResponse(recipe_image)
|
return FileResponse(recipe_image, media_type="image/webp")
|
||||||
else:
|
else:
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND)
|
raise HTTPException(status.HTTP_404_NOT_FOUND)
|
||||||
|
|
||||||
|
@ -48,7 +43,7 @@ async def get_recipe_timeline_event_img(
|
||||||
)
|
)
|
||||||
|
|
||||||
if timeline_event_image.exists():
|
if timeline_event_image.exists():
|
||||||
return FileResponse(timeline_event_image)
|
return FileResponse(timeline_event_image, media_type="image/webp")
|
||||||
else:
|
else:
|
||||||
raise HTTPException(status.HTTP_404_NOT_FOUND)
|
raise HTTPException(status.HTTP_404_NOT_FOUND)
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,7 @@ from starlette.responses import FileResponse
|
||||||
|
|
||||||
from mealie.schema.user import PrivateUser
|
from mealie.schema.user import PrivateUser
|
||||||
|
|
||||||
"""
|
router = APIRouter(prefix="/users")
|
||||||
These routes are for development only! These assets are served by Caddy when not
|
|
||||||
in development mode. If you make changes, be sure to test the production container.
|
|
||||||
"""
|
|
||||||
|
|
||||||
router = APIRouter(prefix="/users", include_in_schema=False)
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/{user_id}/{file_name}", response_class=FileResponse)
|
@router.get("/{user_id}/{file_name}", response_class=FileResponse)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue