• webv4/lib/pages.js

    From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Mon Jul 27 02:10:11 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/0d40b6dee4a74050c05d43ed
    Modified Files:
    webv4/lib/pages.js
    Log Message:
    webv4: don't let a wildcard or directory page name throw

    A request for /index.xjs?page=* logged:

    !JavaScript lib/pages.js line 48: TypeError: file_getext(file) is
    undefined

    getPagePath() gates on file_exists(), which is fexist() -- and a
    filespec containing a wildcard is globbed rather than tested as a
    literal name, so "pages\*" matches the first file in the directory and
    the wildcard path is handed back as though it were a page. It then
    passes the "must live under web_pages" prefix check, and file_getext()
    returns undefined for it (no extension), so .toUpperCase() throws.

    file_exists() on a directory is false on Windows but true on Unix (glob
    matches directories), so ?page=<subdirectory-of-pages> -- e.g. the
    stock "More" folder -- reaches the same throw on a Unix host.

    Reject page names containing wildcard characters, require a regular
    file rather than merely an existing path, and treat an absent extension
    as "" at the three file_getext().toUpperCase() sites. An unusable page
    name now falls back to the home page as any other bad one does.

    Wildcard globbing in getPagePath() dates to fbaf71eac5e (2020-09-23);
    the unguarded file_getext() in getCtrlLine() to 6369a1472aa
    (2019-03-14).

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net