Repository navigation
feat(issues): support Markdown and pasted images in new requirements - #1303
Robert0622 wants to merge 3 commits into
Conversation
|
结论:建议合入 GitHub 拒绝了 Pull Request Review 接口(HTTP 403:Tencent 组织启用了 OAuth App 访问限制)。当前账号无法提交正式 Approve / Request changes。以下改为普通评论。 核对了新建需求的 Markdown 预览、粘贴图片和保存后的展示。图片与需求在同一事务里写入,格式、张数和大小都有服务端校验,未登录不能读取;关联 TAPD 或工蜂后会把图片复制到新编号。测试覆盖了非法图片整单回滚、复制后仍可读取,以及预览里脚本和 javascript 链接不会变成图片。CI 的 core 仍在跑,其余检查已通过,与 main 可合并。 |
crispinhu27
left a comment
There was a problem hiding this comment.
Approve at 5eacb140e660d1ce6a2bbf3e79544288ff45007b (base main@be35aff8). No open confirmed defects.
Scope: full diff against main. That covers the issue image upload/storage (issue_images model, migration 042), the GET /api/issues/:id/images/:imageId route, size/count/type limits, cleanup on issue delete and tracker ID change, the tracker save-error change in internal/tracker/service.go, and the composer/rendering changes in web/ and chatbot/.
Verification in an isolated sandbox (synthetic data, no credentials):
- At
798844d6,TestIssueRoutesCoverRegisteredPathsfailed (expected 13 issue sub-routes, got 14) and passed on base.5eacb140updates the expected count to 14, and that is its only change. I re-ran the test at this head: PASS. go test ./internal/httpapi/ ./internal/repo/ ./internal/tracker/ -count=1at this head: repo and tracker pass. In httpapi, the only failures are 5 browser/workspace tests that also fail on base in the sandbox (no Chromium / host tooling). They are not caused by this PR.- At
798844d6(web/chatbot unchanged since):npm --prefix webtest test259/259 passing, including the new composer test (draft text and images kept on a 503). Chatbot tests 486/486 passing, and the build succeeds. - Code review of security-relevant paths: the image GET uses the same auth dispatcher as
GET /api/issues/:id, and the lookup is keyed on both issue ID and image ID. Upload is capped byMaxBytesReaderplus per-image and count limits, and the content is sniffed (PNG/JPEG/WebP/GIF only, no SVG). Responses setnosniffandno-store. Description rendering escapes text and only allows http(s) URLs, and only same-origin URLs become<img>. - All 16 check runs on this head are green, including
coreandplatform-required.
Non-blocking notes:
- Migration number
042collides with other open PRs (#1301, #1286), so renumber at merge time. 042_issue_images.sqldeclaresposition INT, while gorm maps Gointtobigint. AutoMigrate may alter a hand-created table. This is harmless but inconsistent.saveCreatedTrackerIssuenow returns the local save error. If the remote item was already created, a retry could create a duplicate remote item. I did not reproduce this.
This review covers the head above only.
CR + 部署实测(head
|
What changed
Scope
Compatibility
Markdown-only creation uses the existing JSON request. Creation with images uses multipart and stores files in a new
issue_imagestable.042_issue_images.sqlis available for deployments that apply schema changes manually.The dialog accepts up to eight PNG, JPEG, WebP or GIF images, with a 10 MiB per-image limit and a 20 MiB total limit. Pasted files stay in the open dialog until submission.
Validation
bash scripts/build-chatbot.shpassed (486 tests).npm --prefix webtest testpassed.go test -p=2 ./web -count=1 -timeout=120spassed after the blank submission fix.internal/httpapi,internal/repo,internal/trackerandwebpassed.go vet -p=2 ./...,python3 scripts/check-public.pyandbash scripts/scan-secrets.shpassed.go test -p=2 ./... -count=1 -timeout=180srun reached the package timeout ininternal/engineandinternal/httpapi, and reported a bubblewrap mount assertion failure ininternal/runtime.mainin the same environment.