fix: 头像缓存版本号;移除回忆录撰写入口跳转聊天
- API:上传/预设头像 URL 追加 ?v=time.time_ns(),避免同路径缓存导致「只能换一次头像」 - Expo:回忆录 Tab 去掉撰写中「继续写作」及新建会话跳转;清理 memoir 文案键并更新 i18n 类型 未纳入提交:本地 api/uploads/(开发环境头像文件) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import io
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import APIRouter, Depends, File, HTTPException, UploadFile, status
|
||||
@@ -331,7 +332,8 @@ async def upload_avatar(
|
||||
|
||||
image.save(file_path, "JPEG", quality=85, optimize=True)
|
||||
|
||||
avatar_url = f"/api/auth/avatars/{filename}"
|
||||
# 路径固定为 {user_id}.jpg,客户端会缓存;每次写入新文件后 bump URL 以绕过缓存。
|
||||
avatar_url = f"/api/auth/avatars/{filename}?v={time.time_ns()}"
|
||||
user = await service.update_avatar_url(current_user.id, avatar_url)
|
||||
return _user_response(user)
|
||||
except HTTPException:
|
||||
@@ -379,7 +381,7 @@ async def set_avatar_preset(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail="预设头像不可用",
|
||||
)
|
||||
avatar_url = avatar_url_for_preset_filename(filename)
|
||||
avatar_url = f"{avatar_url_for_preset_filename(filename)}?v={time.time_ns()}"
|
||||
try:
|
||||
user = await service.update_avatar_url(current_user.id, avatar_url)
|
||||
except AuthError as e:
|
||||
|
||||
Reference in New Issue
Block a user