1
0
Fork 0
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:
Michael Genson 2024-10-25 09:53:42 -05:00 committed by GitHub
parent d48320f0a5
commit f7e595b404
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 15 deletions

View file

@ -131,7 +131,6 @@ HEALTHCHECK CMD python $MEALIE_HOME/mealie/scripts/healthcheck.py || exit 1
# ----------------------------------
# Copy Frontend
# copying caddy into image
ENV STATIC_FILES=/spa/static
COPY --from=builder /app/dist ${STATIC_FILES}

View file

@ -7,12 +7,7 @@ from starlette.responses import FileResponse
from mealie.schema.recipe import Recipe
from mealie.schema.recipe.recipe_timeline_events import RecipeTimelineEventOut
"""
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)
router = APIRouter(prefix="/recipes")
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)
if recipe_image.exists():
return FileResponse(recipe_image)
return FileResponse(recipe_image, media_type="image/webp")
else:
raise HTTPException(status.HTTP_404_NOT_FOUND)
@ -48,7 +43,7 @@ async def get_recipe_timeline_event_img(
)
if timeline_event_image.exists():
return FileResponse(timeline_event_image)
return FileResponse(timeline_event_image, media_type="image/webp")
else:
raise HTTPException(status.HTTP_404_NOT_FOUND)

View file

@ -4,12 +4,7 @@ from starlette.responses import FileResponse
from mealie.schema.user import PrivateUser
"""
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 = APIRouter(prefix="/users")
@router.get("/{user_id}/{file_name}", response_class=FileResponse)