記事本文内の相対リンクを元記事URL基準で絶対URLに変換 (Closes #59)#81
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
記事本文中の相対リンクがローカルアプリの URL として解釈されてしまう問題を、article.url を基準に本文 HTML 内の <a href> / <img src> を絶対 URL 化することで解消し、あわせてリンクのオープン挙動を外部ブラウザに統一する変更です(フロントエンドの表示品質改善)。
Changes:
resolveContentLinksユーティリティを追加し、本文 HTML 内のリンク/画像 URL をarticle.url基準で解決- 本文内
<a>にtarget="_blank"とrel="noopener noreferrer"を付与する処理を追加 resolveContentLinksのユニットテストを追加し、ArticleViewに適用
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| web/src/utils/resolveLinks.ts | 本文 HTML をパースし、href/src の URL 解決と <a> 属性付与を実施 |
| web/src/utils/tests/resolveLinks.test.ts | resolveContentLinks のユニットテスト追加 |
| web/src/components/ArticleView.tsx | 表示時に resolveContentLinks を通してから DOMPurify でサニタイズ |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
/blog/等)がローカルアプリのURLとして解釈される問題を修正resolveContentLinksユーティリティを追加し、article.urlを基準に<a href>/<img src>の相対URLを絶対URLへ変換target="_blank" rel="noopener noreferrer"を付与し外部ブラウザで開くように統一Test plan
resolveContentLinksのユニットテスト(11ケース)が全て通過https://go.dev/...に解決されることを確認🤖 Generated with Claude Code