Remove URL fetch capability from editor.js playground#23381
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b9adb9a7-1d74-424c-8c51-c3bf3e06e391 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
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.
| sampleSelect.addEventListener('change', () => { | ||
| const key = sampleSelect.value; | ||
| if (key === '__url') return; | ||
| loadSample(key); | ||
| }); |
There was a problem hiding this comment.
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.
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
fetchContent(),toRawGitHubUrl(),contentCache,ALLOWED_FETCH_ORIGINSissue-triage,ci-doctor,contribution-check,daily-repo-statusentries fromSAMPLES(all were URL-only with no inline content)loadFromHash()now only resolves built-in sample keys;http(s)://hashes no longer trigger a fetchloadSample()is now synchronous — no fetch path, no error handling for network failures__urlsentinel value from the sample selector change handler