Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update provider parameters, check for valid provider #2594

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove starlette._compat dependency
  • Loading branch information
hlohaus committed Jan 24, 2025
commit a7d8c167b679fde85f95816933d0fd56f8c51d66
4 changes: 2 additions & 2 deletions g4f/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shutil
from email.utils import formatdate
import os.path
import hashlib
from fastapi import FastAPI, Response, Request, UploadFile, Depends
from fastapi.middleware.wsgi import WSGIMiddleware
from fastapi.responses import StreamingResponse, RedirectResponse, HTMLResponse, JSONResponse
Expand All @@ -27,7 +28,6 @@
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials, HTTPBasic
from fastapi.middleware.cors import CORSMiddleware
from starlette.responses import FileResponse
from starlette._compat import md5_hexdigest
from types import SimpleNamespace
from typing import Union, Optional, List

Expand Down Expand Up @@ -511,7 +511,7 @@ async def get_image(filename, request: Request):
headers={
"content-length": str(stat_result.st_size),
"last-modified": formatdate(stat_result.st_mtime, usegmt=True),
"etag": f'"{md5_hexdigest(filename.encode(), usedforsecurity=False)}"'
"etag": f'"{hashlib.md5(filename.encode()).hexdigest()}"'
},
)
try:
Expand Down
Loading