Conversation
… resolution logic
WalkthroughLocal image resolution now safely decodes encoded paths, rejects encoded separators, handles file URIs defensively, and adds coverage for spaces, fragments, references, remote URLs, and malformed inputs. ChangesLocal image path resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/e2e/preview.e2e.test.ts (1)
54-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftExercise these cases through the preview UI.
These assertions only validate fixture contents; they do not open
image-paths.mdor verify rendered image resource URIs. A parser-to-preview integration regression would still pass. Add preview-level assertions for the three local image forms.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/e2e/preview.e2e.test.ts` around lines 54 - 57, Extend the preview UI flow in the image-paths end-to-end test to open image-paths.md and assert rendered image resource URIs for the three local image forms: normal paths, percent-encoded spaces, and angle-bracket paths with spaces. Keep the existing fixture-content assertions, but add preview-level checks that verify each corresponding image is actually rendered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/e2e/preview.e2e.test.ts`:
- Around line 54-57: Extend the preview UI flow in the image-paths end-to-end
test to open image-paths.md and assert rendered image resource URIs for the
three local image forms: normal paths, percent-encoded spaces, and angle-bracket
paths with spaces. Keep the existing fixture-content assertions, but add
preview-level checks that verify each corresponding image is actually rendered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 35352d69-9489-4f19-a592-3574d3b15685
⛔ Files ignored due to path filters (2)
.e2e-workspace/assets/name with spaces.svgis excluded by!**/*.svg.e2e-workspace/assets/normal-image.svgis excluded by!**/*.svg
📒 Files selected for processing (6)
.e2e-workspace/image-paths.mdsrc/extension/preview/markdown/linkResolver.tstest/e2e/preview.e2e.test.tstest/unit/helpers/vscodeMock.tstest/unit/linkResolver.test.tstest/unit/markdownPipeline.test.ts
Summary
Root cause
Markdown image destinations such as
name%20with%20spaces.pngreachedvscode.Uri.joinPathstill URL-encoded.joinPathtreats its arguments as filesystem path text, so the percent sequence became part of the filename and the extension attempted to loadname%20with%20spaces.pnginstead ofname with spaces.png.The fix decodes each relative URI path segment exactly once at the URI-to-filesystem boundary. Encoded forward and backward slashes are rejected so decoding cannot introduce new path boundaries. Absolute
file:URLs continue throughvscode.Uri.parse, and workspace containment is checked against the final resolved URI.Validation
npm run test:unit- 119 tests passednpm run lint- passednpm run build- passednpm run test:e2e- 3 passed, 1 optional GUI test skippedlinkResolver.ts- passedgit diff --check- passedType-check note
The repository-wide
npx tsc --noEmitcommand still reports existing unrelated strict-type errors and missing third-party declarations. No error is reported in the changed production resolver.Summary by CodeRabbit
New Features
Bug Fixes
Tests