Skip to content

Fix patch webview asset resolution in source checkouts#111

Merged
unknowIfGuestInDream merged 5 commits into
masterfrom
copilot/bug-fix-empty-patch-visualization
Jul 3, 2026
Merged

Fix patch webview asset resolution in source checkouts#111
unknowIfGuestInDream merged 5 commits into
masterfrom
copilot/bug-fix-empty-patch-visualization

Conversation

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Email-style patch files could open with a blank visual view even though the patch content itself was valid. The issue was not diff parsing; the webview could fail to load diff2html assets when running from a fresh clone or local source checkout without copied media assets.

  • Runtime asset resolution

    • Resolve diff2html assets from media/diff2html when packaged assets are present.
    • Fall back to node_modules/diff2html/bundles for local development and test runs.
    • Emit a clearer log entry when neither asset location is available.
  • Focused regression coverage

    • Add tests for both resolution paths:
      • packaged media assets win when present
      • node_modules is used when media assets are absent
    • Wrap temp-directory setup in try/finally to keep test cleanup deterministic.
  • Changelog

    • Note the local asset-loading fix under Unreleased.
const mediaAssetRoot = path.join(extensionPath, 'media', 'diff2html');
if (hasDiff2HtmlAssets(mediaAssetRoot)) {
    return mediaAssetRoot;
}

const nodeModulesAssetRoot = path.join(extensionPath, 'node_modules', 'diff2html', 'bundles');
if (hasDiff2HtmlAssets(nodeModulesAssetRoot)) {
    return nodeModulesAssetRoot;
}

Copilot AI linked an issue Jul 3, 2026 that may be closed by this pull request
3 tasks
@pull-request-size pull-request-size Bot added size/M and removed size/XS labels Jul 3, 2026
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 3, 2026
Copilot AI changed the title [WIP] Fix empty visualization in patch content Fix patch webview asset resolution in source checkouts Jul 3, 2026
@unknowIfGuestInDream
unknowIfGuestInDream marked this pull request as ready for review July 3, 2026 02:45
Update changelog for version 1.0.2 release.

Signed-off-by: 梦里不知身是客 <liang.tang.cx@gmail.com>
@unknowIfGuestInDream
unknowIfGuestInDream merged commit b17fc89 into master Jul 3, 2026
6 checks passed
@unknowIfGuestInDream
unknowIfGuestInDream deleted the copilot/bug-fix-empty-patch-visualization branch July 3, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 问题修复

2 participants