Skip to content

fix: serve local avatar assets from server#7

Merged
ailuckly merged 1 commit into
developfrom
feat/realtime-voice-stt-p0-p1
Apr 9, 2026
Merged

fix: serve local avatar assets from server#7
ailuckly merged 1 commit into
developfrom
feat/realtime-voice-stt-p0-p1

Conversation

@ailuckly
Copy link
Copy Markdown
Owner

@ailuckly ailuckly commented Apr 9, 2026

📌 变更内容

  • 如:新增用户登录 API
  • 如:修复登录失败时错误提示

✅ 测试验证

  • 本地运行通过
  • 自测通过
  • CI 流水线通过

PR 提交规范提醒:

  • 确保提交主题信息符合约定式提交规范 (feat/fix/docs/style/refactor/test/chore)
  • 确保代码已经通过本地测试
  • 确保没有提交敏感信息(密码、密钥等)

Copilot AI review requested due to automatic review settings April 9, 2026 14:10
@ailuckly ailuckly merged commit 02fd30a into develop Apr 9, 2026
6 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds server-side static resource handling so character avatar images can be served from a local filesystem directory (e.g., a Docker-mounted volume) instead of only relying on external storage URLs.

Changes:

  • Add a Spring MVC ResourceHandler mapping /static/avatar/** to a configurable local directory.
  • Introduce vocata.static.character-avatar-path configuration (env-overridable).
  • Mount ./data/img into the server container at /app/data/img (read-only) for local avatar assets.
  • Add a Mockito MockMaker extension configuration for tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
vocata-server/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker Forces Mockito mock maker to subclass for tests.
vocata-server/src/main/resources/application.yml Adds vocata.static.character-avatar-path config key.
vocata-server/src/main/java/com/vocata/config/WebMvcConfig.java Registers /static/avatar/** -> filesystem resource handler.
docker-compose.yml Mounts local avatar directory into the container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +15
@Value("${vocata.static.character-avatar-path:file:/app/data/img/}")
private String characterAvatarPath;
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

character-avatar-path 的默认值在 application.yml 和这里的 @Value(...:file:/app/data/img/) 中重复维护,后续改路径时容易发生漂移。建议只保留一处默认值(更推荐在配置文件里),并让代码只读取必填属性。

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +21
registry.addResourceHandler("/static/avatar/**")
.addResourceLocations(ensureTrailingSlash(characterAvatarPath))
.setCachePeriod(3600);
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

这里直接把配置值传给 addResourceLocations(...),如果运维把环境变量配置成常见的“裸路径”(例如 /app/data/img) 而不是带 file: scheme 的形式,Spring 会把它当作非文件 URL 资源位置,导致静态资源无法被正确解析。建议在进入 addResourceLocations 前对路径做规范化(必要时补全 file: 前缀)并对空字符串等异常配置做显式失败处理,避免意外暴露错误目录。

Copilot uses AI. Check for mistakes.
@@ -0,0 +1 @@
mock-maker-subclass
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

该文件显式指定 mock-maker-subclass,但当前 pom 仅引入 spring-boot-starter-test(默认就是 subclass mock maker),因此这份配置看起来是冗余的;同时它会阻止未来使用 Mockito inline 能力(例如 mock final/static)。建议删除该文件,或在测试文档/注释中说明为何需要强制使用 subclass。

Copilot uses AI. Check for mistakes.
Comment thread docker-compose.yml
Comment on lines 85 to 88
volumes:
- ./vocata-server/logs:/app/logs
- ./data/img:/app/data/img:ro
healthcheck:
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

PR 描述仍是模板占位内容,未说明本次“本地头像静态资源由服务端提供”的具体实现方式(资源路径、配置项、docker volume 等)以及实际验证步骤。建议更新 PR description,便于评审与回归。

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants