"Sketchbook" menu missing if sketch name is invalid regex #1600
Labels
conclusion: resolved
Issue was resolved
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Describe the problem
The File > Sketchbook menu provides convenient access to the sketches the user has stored under their sketchbook folder.
During the population of this menu, the IDE processes each sketch name as a regular expression:
arduino-ide/arduino-ide-extension/src/node/sketches-service-impl.ts
Line 160 in 0d05509
🐛 If a sketch with a name that happens to be an invalid regular expression is present in the sketchbook, the File > Sketchbook menu is missing.
To reproduce
Foo
🙂 The "Foo" sketch and any other sketches present in the sketchbook are listed in the menu.
Bar++
🐛 There is no File > Sketchbook menu.
Expected behavior
File > Sketchbook menu is populated with all valid sketches even if invalid sketches are also present in the sketchbook.
Arduino IDE version
2.0.1
Operating system
Operating system version
Additional context
This issue is not about supporting non-compliant sketch names. I used File > Save As... in the demo in order to make it as simple as possible to reproduce this bug. However, even after the bug of the IDE allowing the creation of non-compliant sketch names (#1599) is fixed, the user may still create or find such sketches (which will become increasingly prevalent since the IDE allows their creation) in the wild. The IDE must handle the presence of such invalid sketches gracefully, rather than breaking.
One option for resolving the issue would be to escape the
sketchName
string for use in a regular expression, as done here:https://stackoverflow.com/a/6969486/7059512
I bisected the introduction of the bug to 4c55807 / #1018 (does not occur with the build for cb50d3a)
Originally reported by @Willem43T at https://forum.arduino.cc/t/2-0-1-no-open-recent-menu-item/1046905/6
Issue checklist
The text was updated successfully, but these errors were encountered: