[Bug]: [Policy Hub] In-page anchor links in policy docs go to the Policy Hub home page instead of the section

オープン
#4,372 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
html, typescript
領域
frontend

調査の方向性

Start with frontend/index.html, MarkdownRenderer.tsx, and TableOfContents.tsx, which the issue identifies as the sources of the two failures. Trace how fragment links are resolved with the base URL and when policy headings receive IDs after docs load. Reproduce using the llm-cost policy link, then verify both clicking an in-page link and opening a policy URL with a fragment land on the section.

索引モデルが issue の本文から書いたものです。

説明

Aspect/API Aspect/UX Severity/Minor Type/Bug
Please select the area the issue is related to

Gateway

Please select the aspect the issue is related to

Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI), Aspect/UX (User experience, flows, usability, clarity)

Description

In-page anchor links in policy docs, such as [Adding Your Own Pricing](#adding-your-own-pricing), don't work on the Policy Hub. Clicking one loads the hub's home page instead of jumping to the section. The links are standard markdown and work on GitHub.

There are two causes, both in the frontend:

  1. <base> redirects fragment links. frontend/index.html (lines 11–25) injects <base href="/api-management/policy-hub/">. With a <base> element, the browser resolves every relative URL against the base URL, fragment-only links included. So #adding-your-own-pricing becomes /api-management/policy-hub/#adding-your-own-pricing, which is the hub root. MarkdownRenderer.tsx passes these links through unchanged, because its urlTransform (line 193) only rewrites URLs that start with ..
  2. Sections can't be linked to directly. Opening /policies/<name>#<section> leaves the page at the top. Docs are fetched after the page has loaded, and headings only get ids afterwards, when TableOfContents.tsx tags them (lines 54–59, h2/h3 only). When the browser tries to jump to the fragment, the heading doesn't exist yet.

Impact:
21 of the 72 policies on the hub have these links in their latest published version, 71 links in total:

mtls-auth (14), typesafe-jev-mcp-tool-intent-verification (7), opa-policy (6), typesafe-jev-mcp-tool-result-screening (6), typesafe-jev-tool-filtering (5), aws-authentication (4), jwt-auth (4), semantic-cache (4), typesafe-jev-content-safety (4), oauth2-generator (3), backend-jwt (2), mcp-authz (2), mcp-tool-schema-validator (2), error-response-formatter (1), llm-cost (1), llm-cost-based-ratelimit (1), log-message (1), mcp-auth (1), oauth2-token-exchange (1), opaque-token-auth (1), typesafe-jev-model-routing (1).

16 of these 21 also have older versions with the same links.

Steps to Reproduce
  1. Open https://choreolabs.com/api-management/policy-hub/policies/llm-cost.
  2. In the Notes section, click Adding Your Own Pricing.
  3. Expected: the page scrolls to the "Adding Your Own Pricing" section.
    Actual: the browser loads https://choreolabs.com/api-management/policy-hub/#adding-your-own-pricing, the hub's home page.
  4. Open https://choreolabs.com/api-management/policy-hub/policies/llm-cost#adding-your-own-pricing directly.
    Expected: the page opens at that section.
    Actual: the page stays at the top.

The same happens with any in-page link on the policies above, for example the 14 links on https://choreolabs.com/api-management/policy-hub/policies/mtls-auth.

Severity Level of the Issue

Severity/Minor (Non-critical functionality. Can be fixed in future releases)

Environment Details (with versions)
主要言語
Go
スター
85
フォーク
137
平均マージ
1日 12時間
マージ済み PR(30日)
247

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

wso2/api-platform のほかの issue

wso2/api-platform の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。