fix(api): 统一图片上传限制并转换 TIFF 为 PNG#210
Merged
Merged
Conversation
API 上传大小限制改为配置驱动,multipart 413 返回标准 JSON,并将 TIFF 上传规范化保存为 PNG。
将 TIFF 转 PNG 移到 ImageUpload.store,恢复 ImageStorage.cp_file 为纯复制,并更新上传调用点和测试。
Owner
Author
|
已根据 review 调整: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
:image_upload_max_file_size配置,默认 50MB,并支持IMAGE_UPLOAD_MAX_FILE_SIZE覆盖。413。ImageUpload.store/3转换为 PNG,保证详情页和缩略图能在浏览器显示。ImageStorage.cp_file/3为纯 copy,避免 storage copy API 隐式承担格式转换职责。Why
.tiff会导致图片详情页无法正确显示。Validation
mise exec -- mix format✅mise exec -- mix compile --warnings-as-errors✅mise exec -- mix test test/vmemo/memo/image_storage_test.exs test/vmemo_web/api/v1/auth_test.exs test/vmemo_web/api/v1/image_controller_test.exs test/vmemo_web/controllers/file_controller_test.exs✅mise exec -- mix check✅Related
Background
.tiff又导致浏览器详情页无法显示。Notes
.tiff文件不会自动迁移;重新上传后会保存为.png。mix check仍会打印项目已有的 Sobelow/Credo 提示,但命令退出码为 0。