You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The keyboard handlers for n, r, y, d, q, p, w, m, ? don't filter modifier keys, so Cmd+R (or Ctrl+R) fires the wastebin r shortcut alongside the browser reload. The c handler at the bottom of onKey correctly filters with && !(e.ctrlKey || e.metaKey) — that fix from Honor selection for copying via Ctrl-C? #159 was never propagated to the other shortcuts.
The r/d/q shortcuts compose their target URL by prepending /raw, /dl, /qr to window.location.pathname. On /md/{id} pages this produces /raw/md/{id}, which 404s. The correct raw URL is /raw/{id} (no md/ segment) — that one returns 200.
These compound into the user-visible failure: Cmd+R on /md/{id} navigates to a 404 instead of reloading the rendered view.
Repro
Create a Markdown paste (extension md).
Open the rendered view: /md/{id}.
Press Cmd+R (macOS) or Ctrl+R (Linux/Windows).
URL becomes /raw/md/{id} → 404.
Expected
Browser reload leaves the page on /md/{id} and re-renders.
Even with the plain r shortcut, the raw target on a /md/{id} page should be /raw/{id}, not /raw/md/{id}.
Source pointers (paste.js)
```js
function onKey(e) {
if (e.key == 'n') { // missing modifier filter
window.location.href = "/";
}
else if (e.key == 'r') { // missing modifier filter
window.location.href = "/raw" + window.location.pathname; // wrong on /md/{id}
}
...
else if (e.key == 'd') { // same bugs
window.location.href = "/dl" + window.location.pathname;
}
else if (e.key == 'q') { // same bugs
window.location.href = "/qr" + window.location.pathname;
}
else if (e.key == 'c' && !(e.ctrlKey || e.metaKey)) { // correct (post-#159)
copy();
}
...
}
```
Suggested fix
Apply the `&& !(e.ctrlKey || e.metaKey)` filter (from the `c` handler) to all unmodified-key shortcuts.
Derive the `/raw`, `/dl`, `/qr` targets from the paste id rather than `location.pathname` — e.g. expose the id as `data-paste-id` on `` and read it in the handler.
Summary
Two related bugs in
paste.js:n,r,y,d,q,p,w,m,?don't filter modifier keys, soCmd+R(orCtrl+R) fires the wastebinrshortcut alongside the browser reload. Thechandler at the bottom ofonKeycorrectly filters with&& !(e.ctrlKey || e.metaKey)— that fix from Honor selection for copying via Ctrl-C? #159 was never propagated to the other shortcuts.r/d/qshortcuts compose their target URL by prepending/raw,/dl,/qrtowindow.location.pathname. On/md/{id}pages this produces/raw/md/{id}, which 404s. The correct raw URL is/raw/{id}(nomd/segment) — that one returns 200.These compound into the user-visible failure:
Cmd+Ron/md/{id}navigates to a 404 instead of reloading the rendered view.Repro
md)./md/{id}.Cmd+R(macOS) orCtrl+R(Linux/Windows)./raw/md/{id}→ 404.Expected
/md/{id}and re-renders.rshortcut, the raw target on a/md/{id}page should be/raw/{id}, not/raw/md/{id}.Source pointers (
paste.js)```js
function onKey(e) {
if (e.key == 'n') { // missing modifier filter
window.location.href = "/";
}
else if (e.key == 'r') { // missing modifier filter
window.location.href = "/raw" + window.location.pathname; // wrong on /md/{id}
}
...
else if (e.key == 'd') { // same bugs
window.location.href = "/dl" + window.location.pathname;
}
else if (e.key == 'q') { // same bugs
window.location.href = "/qr" + window.location.pathname;
}
else if (e.key == 'c' && !(e.ctrlKey || e.metaKey)) { // correct (post-#159)
copy();
}
...
}
```
Suggested fix
Tested on wastebin 3.6.1.