fix: PNG cover 404 via nginx + clear upload residual after submit

- Fix UAT nginx static cache rule intercepting /api/files/*.png requests,
  use negative lookahead to exclude /api/ paths (same as Dev config)
- Clear el-upload file list after successful game creation to prevent
  residual file path showing in next upload

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
congsh
2026-04-24 14:29:32 +08:00
parent ceafc873c7
commit f3fe7d4f2d
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -60,8 +60,8 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
# 静态资源缓存(排除 /api/ 路径,避免拦截 PB 文件请求)
location ~* ^/(?!api/|voice-api/).*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|webp)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
@@ -5,7 +5,7 @@ import type { GamePlatform } from '@/types'
import { ElMessage } from 'element-plus'
import { getAllPlatforms } from '@/api/games'
import { Plus } from '@element-plus/icons-vue'
import type { UploadFile } from 'element-plus'
import type { UploadFile, UploadInstance } from 'element-plus'
const props = defineProps<{
modelValue: boolean
@@ -27,6 +27,7 @@ const platform = ref<GamePlatform | ''>('')
const tagsInput = ref('')
const coverFile = ref<File | null>(null)
const coverPreview = ref('')
const uploadRef = ref<UploadInstance>()
const loading = ref(false)
const platforms = getAllPlatforms()
@@ -62,6 +63,7 @@ async function handleSubmit() {
tagsInput.value = ''
coverFile.value = null
coverPreview.value = ''
uploadRef.value?.clearFiles()
emit('created')
visible.value = false
} catch (error: any) {
@@ -92,6 +94,7 @@ async function handleSubmit() {
<div class="field">
<label>封面图</label>
<el-upload
ref="uploadRef"
:auto-upload="false"
:limit="1"
accept="image/*"