open
https://gitlab.synchro.net/main/sbbs/-/work_items/1423
2026-11-24 11:49:44 -0800
## Summary
Quoted terms in a file search expression don't survive the trip to a List Files loadable module. Encoding the two characters that the module command line mangles, `"` and `%`, as `%22` and `%25` would fix that, while single-word and multi-word searches reach existing modules unchanged.
@nightfox: this would change what DD File Lister receives for searches containing quotes, so your input is welcome.
## The problem
The Terminal Server runs a List Files module with `<dir code> <mode> <filespec>` (`listfiles()`, `src/sbbs3/listfile.cpp`), where in `FL_FIND` mode the filespec is the user's boolean search expression (as entered at `SearchStringPrompt`, uppercased). A module's command line is split into `argv` by `js_execfile()` (`src/sbbs3/exec.cpp`):
- an argument that **starts** with `"` runs to the next `"`, and the quotes are dropped
- runs of spaces collapse
So in the expression syntax (`text/menu/textsrch.msg`), where `"WORD"` means a whole-word match:
| User types | Module gets (args joined with spaces) |
|---|---|
| `NOFX` | `NOFX` |
| `SOUL DOUBT` | `SOUL DOUBT` |
| `"NOFX"` | `NOFX` (now a substring match: also finds `BGACAPELLANOFX_03`) |
| `"NO FX" OR PUNK` | `NO FX OR PUNK` (a different expression) |
| `" WORD "` | `WORD` |
`listfiles.js` re-evaluates the expression with `bool_search()`, so it lists different files than the user asked for.
## Proposal
In `FL_FIND` mode, pass the search expression with `%` encoded as `%25` and `"` as `%22`. Nothing else changes:
- a module joins `argv[2]` onward with single spaces (as `listfiles.js` and DD File Lister both do) and decodes `%22` and `%25`
- searches without quotes or `%` (the common case: one word, or a phrase) are byte-for-byte what modules get today
- the only remaining loss is repeated spaces collapsing, which doesn't matter in practice
The new Extended File Info module (#1421) would pass its search argument the same way, so both modules share one scheme.
### Compatibility
- **DD File Lister** (`xtrn/ddfilelister`): unaffected unless the search contains `"` or `%`. It matches the expression as plain text (see #1422), so a quoted search doesn't work there today either; with encoding it would search for the literal `%22...%22` until it decodes. Decoding is a one-liner: `expr.replace(/%22/g, "\"").replace(/%25/g, "%")` (decode `%25` last).
- **Old modules on a new build** see `%22`/`%25` only in searches with quotes or a percent sign.
- **New modules on an old build** would decode a user's literal `%22` or `%25`; harmless in practice. A module that needs to know can check `system.version_num` (or the build date) for the release that adds this.
## Alternatives considered
- **Percent-encode spaces too** (one argument, exact): preserves repeated spaces as well, but every multi-word search would then reach DD File Lister as `SOUL%20DOUBT` until it decodes. Not worth it.
- **Pass the expression some other way** (e.g. a `bbs` property for the current search): no encoding at all, but it's session state that can go stale, and every module would need a new code path.
- **Change `js_execfile()`'s quote handling**: affects every module and `;EXEC` command line.
- *Authored by Claude (Claude Code), on behalf of @rswindell*
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net