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

feat: allow anonymous user to upload files #695

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions server/auth/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"/api/auth/userinfo",
"/api/chat/qa",
"/api/chat/stream_qa",
"/api/aws/upload",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding /api/aws/upload to the list of routes without authentication checks may expose the system to unauthorized file uploads. Consider implementing proper authentication or validation to ensure security.

]

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/auth/token")
Expand Down
7 changes: 0 additions & 7 deletions server/aws/router.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
from typing import Annotated
from fastapi import APIRouter, Depends, File, UploadFile, Form

Check failure on line 1 in server/aws/router.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

aws/router.py:1:20: F401 `typing.Annotated` imported but unused

from auth.get_user_info import get_user
from core.models.user import User
from .schemas import ImageMetaData
from .dependencies import get_s3_client
from .service import upload_image_to_s3

Check failure on line 4 in server/aws/router.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

aws/router.py:4:32: F401 `auth.get_user_info.get_user` imported but unused

Check failure on line 5 in server/aws/router.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

aws/router.py:5:30: F401 `core.models.user.User` imported but unused

ALLOWED_MIME_TYPES = {"image/jpeg", "image/png", "image/gif", "image/webp"}

router = APIRouter(
prefix="/api/aws",
tags=["aws"],
Expand Down
Loading