-
Notifications
You must be signed in to change notification settings - Fork 154
Open
Labels
bugUndesirable behaviorUndesirable behavior
Description
Description:
Having entered an invalid regular expression in the "Window Properties" settings (e.g., a typo like /*Slack/), the extension crashed and failed to reload, and locked me out of the extension until the setting was cleared or corrected.
Having access to settings via Extension Manager meant a fix/workaround was easy to apply. The slightly trickier part is to connect the dots. In my case the edit was recent enough to make a smell.
Steps to Reproduce:
- Open PaperWM Settings -> Window Properties.
- Add a new property.
- In wm_class or title, enter an invalid regex string like /*Test/ (where * is the first character inside the slashes).
- The extension will crash with SyntaxError: nothing to repeat.
Stack Trace / Error:
1 SyntaxError: nothing to repeat @ file:///.../paperwm@paperwm.github.com/settings.js:468:30
Suggested Fix:
In settings.js, the new RegExp() calls should be wrapped in try...catch blocks to handle user input errors gracefully.
Example Patch:
// settings.js
try {
prop.wm_class = new RegExp(inner, flags);
} catch (e) {
console.warn(`PaperWM: Invalid regex in user settings for wm_class: ${prop.wm_class}`, e);
}
System information:
Distribution: Fedora Linux 43 (Workstation Edition)
GNOME Shell: 49.3
Display server: Wayland
PaperWM version: 49.0.0
Enabled extensions:
- launch-new-instance@gnome-shell-extensions.gcampax.github.com
Metadata
Metadata
Assignees
Labels
bugUndesirable behaviorUndesirable behavior