Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Fix creating users service (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegYurchik authored Mar 15, 2024
2 parents c81388c + 5c0b93b commit b1b01b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sapphire/projects/api/rest/projects/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async def partial_update_project(
async def get_project_avatar(
project: Project = fastapi.Depends(get_path_project),
) -> FileResponse:
if project.avatar is None:
if project.avatar is None or not pathlib.Path(project.avatar).is_file():
return None

return FileResponse(project.avatar)
Expand Down
2 changes: 1 addition & 1 deletion sapphire/users/api/rest/users/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def update_user(


async def get_user_avatar(user: User = fastapi.Depends(get_path_user)) -> FileResponse:
if user.avatar is None:
if user.avatar is None or not pathlib.Path(user.avatar).is_file():
return None

return FileResponse(user.avatar)
Expand Down
2 changes: 2 additions & 0 deletions sapphire/users/api/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def get_service(
habr_career_client=habr_career_client,
oauth2_habr_callback_url=settings.oauth2_habr_callback_url,
jwt_methods=jwt_methods,
media_dir_path=settings.media_dir_path,
load_file_chunk_size=settings.load_file_chunk_size,
version=get_version() or "0.0.0",
root_url=str(settings.root_url),
root_path=settings.root_path,
Expand Down

0 comments on commit b1b01b0

Please sign in to comment.