| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Hey - I've left some high level feedback:
Please address the comments from this code review:
## Overall Comments
- Consider guarding the `mimetypes.add_type` call with a Windows-only check (e.g. `if os.name == 'nt':`) so you don't override any custom or future mappings on non-Windows platforms unnecessarily.
- Instead of a global mimetype side effect at module import, you might centralize this fix where static files are served (e.g. explicitly setting `media_type` for SVG `FileResponse`s) to keep behavior changes more localized and easier to reason about.
Sorry, something went wrong.
|
Consider guarding the mimetypes.add_type call with a Windows-only check (e.g. if os.name == 'nt':) so you don't override any custom or future mappings on non-Windows platforms unnecessarily. |
Sorry, something went wrong.
Done. ^ ^ |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Modifications / 改动点
Fixes #9734
On Windows, Python's mimetypes resolves .svg from the registry to image/svg, a non-standard MIME type. The WebUI static file route serves favicon.svg (and any plugin icon fallback) via Starlette FileResponse, which infers Content-Type from mimetypes.guess_type, so Chrome fails to render these resources.
Registered the standard image/svg+xml type at module load in astrbot/dashboard/server.py. This runs on both entry paths (python main.py and the astrbot run CLI), so the override applies process-wide regardless of how the dashboard is started.
Screenshots or Test Results / 运行截图或测试结果
The bug is Windows-specific and cannot be reproduced on macOS/Linux (which already map .svg to image/svg+xml). Simulated the Windows registry mis-mapping and verified the module-level override wins:
after bad mapping: ('image/svg', None) after fix: ('image/svg+xml', None) via server module: ('image/svg+xml', None)A manual curl -I /favicon.svg on Windows should now return Content-Type: image/svg+xml.
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
/ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txt 和 pyproject.toml 文件相应位置。
😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Bug Fixes:
Summary by Sourcery
Bug Fixes: