Skip to content

Remove URL fetch capability from editor.js playground#23381

Merged
pelikhan merged 1 commit intomainfrom
copilot/remove-fetch-markdown-files
Mar 28, 2026
Merged

Remove URL fetch capability from editor.js playground#23381
pelikhan merged 1 commit intomainfrom
copilot/remove-fetch-markdown-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

The editor playground could load arbitrary 3rd-party markdown files via fetch(), including via URL deep-links in the hash fragment. This is removed entirely — the editor now only accepts directly pasted/typed markdown.

Changes

  • Removed fetch infrastructure: fetchContent(), toRawGitHubUrl(), contentCache, ALLOWED_FETCH_ORIGINS
  • Removed URL-fetched samples: Dropped issue-triage, ci-doctor, contribution-check, daily-repo-status entries from SAMPLES (all were URL-only with no inline content)
  • Simplified deep-linking: loadFromHash() now only resolves built-in sample keys; http(s):// hashes no longer trigger a fetch
  • Simplified sample loading: loadSample() is now synchronous — no fetch path, no error handling for network failures
  • Cleaned up stale guards: Removed the __url sentinel value from the sample selector change handler

@pelikhan pelikhan marked this pull request as ready for review March 28, 2026 20:24
Copilot AI review requested due to automatic review settings March 28, 2026 20:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the editor playground’s ability to fetch and load markdown content from arbitrary URLs (including via hash deep-links), restricting sample loading to built-in, inline content only.

Changes:

  • Removed GitHub/raw URL conversion, fetch logic, caching, and origin allowlist.
  • Dropped URL-only samples and made loadSample() / loadFromHash() synchronous and sample-key-only.
  • Simplified the sample selector change handler by removing the custom-URL sentinel path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 206 to 209
sampleSelect.addEventListener('change', () => {
const key = sampleSelect.value;
if (key === '__url') return;
loadSample(key);
});
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index.html still contains <option> entries for removed sample keys (e.g., issue-triage, ci-doctor, etc.). With the fetch path removed and SAMPLES now containing only hello-world, selecting those options calls loadSample(key) which immediately returns and leaves the UI in a confusing/broken state. Consider either (a) updating the sample selector options to match SAMPLES, or (b) adding a guard here that resets the selector to a valid key / shows an error when SAMPLES[key] is missing.

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit c46362c into main Mar 28, 2026
11 checks passed
@pelikhan pelikhan deleted the copilot/remove-fetch-markdown-files branch March 28, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants