mdn / mdn/browser-compat-data

Linter replaces MDN url anchor when page is now redirecting to anchor

Open
#25,147 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

linter
Dominant language
JSON
Stars
5.8k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
186

Description

What type of issue is this?

Linter issue

What is the issue?

If a feature has an mdn_url that points to an anchor of an MDN page, and that page is removed and redirected to another page with an anchor, then this redirect target replaces the mdn_url and the current anchor gets lost, even if the redirect target has an anchor corresponding to the old mdn_url.

See: https://github.com/mdn/browser-compat-data/pull/25138/commits/4c58e86a0317f28a7ada2d5f9d6daa5f55f711f0

diff --git a/http/headers/Content-Security-Policy.json b/http/headers/Content-Security-Policy.json
index 6c1ee46a99cd45..64dc4a85df7bdc 100644
--- a/http/headers/Content-Security-Policy.json
+++ b/http/headers/Content-Security-Policy.json
@@ -746,7 +746,7 @@
         "report-sample": {
           "__compat": {
             "description": "`report-sample` source value",
-            "mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#report-sample",
+            "mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",
             "support": {
               "chrome": {
                 "version_added": "59"
@@ -1152,7 +1152,7 @@
         "strict-dynamic": {
           "__compat": {
             "description": "`strict-dynamic` source value",
-            "mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#strict-dynamic",
+            "mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",
             "support": {
               "chrome": {
                 "version_added": "52"
@@ -1338,7 +1338,7 @@
         "unsafe-hashes": {
           "__compat": {
             "description": "`unsafe-hashes` source value",
-            "mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#unsafe-hashes",
+            "mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",
             "support": {
               "chrome": {
                 "version_added": "69"
What behavior were you expecting?

We should have not overwritten these specific MDN urls.

What version(s) of BCD is the issue present in?
  • The current BCD release
  • The current version of the main branch
Do you have anything more you want to share?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the linter change shown in Content-Security-Policy.json and inspect the linter logic that follows MDN redirects. Check how URLs with anchors are handled when both the original and redirect target contain anchors. Done means the existing anchor is preserved rather than replaced by the redirect target's page URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.