• src/sbbs3/js_filebase.c

    From Rob Swindell to Git commit to main/sbbs/master on Sunday, April 04, 2021 13:38:22
    https://gitlab.synchro.net/main/sbbs/-/commit/659f6e0d87fea403aae9236d
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix memory leaks caught by Coverity.
  • From Rob Swindell to Git commit to main/sbbs/master on Sunday, April 04, 2021 15:13:57
    https://gitlab.synchro.net/main/sbbs/-/commit/bc4f24f5626f1c7bdf528680
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Alt paths aren't supported/used any longer

    Fixes CID 330973
  • From Rob Swindell to Git commit to main/sbbs/master on Sunday, April 04, 2021 15:13:57
    https://gitlab.synchro.net/main/sbbs/-/commit/aee8542a6afaf51083b869d2
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    dirnum is unsigned, so do not check for negative

    CID 330990
  • From Rob Swindell to Git commit to main/sbbs/master on Tuesday, April 06, 2021 18:37:13
    https://gitlab.synchro.net/main/sbbs/-/commit/e719d289fb2b2f836fb6b321
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Include all properties in getter when detail is MAX

    Adds from/tags/desc/extdesc properties, even when absent or blank.

    When parsing a file object, set the from, desc, tags and cost properties only if they already have been set or the new values is non-blank/0.
  • From Rob Swindell to Git commit to main/sbbs/master on Tuesday, April 06, 2021 19:17:30
    https://gitlab.synchro.net/main/sbbs/-/commit/bf1644a88808595973c4a494
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix missing paren warnings.
  • From Rob Swindell to Git commit to main/sbbs/master on Tuesday, April 06, 2021 19:23:56
    https://gitlab.synchro.net/main/sbbs/-/commit/0d215884b2c89383ff6c59b4
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Don't expand empty from, tags, desc properties unless detail=MAX
  • From Rob Swindell to Git commit to main/sbbs/master on Tuesday, April 06, 2021 23:32:34
    https://gitlab.synchro.net/main/sbbs/-/commit/e7efe6d343ca10a959dfae4e
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix hash() method broken in commit bc4f24f5 - file needs the dir num
  • From Rob Swindell to Git commit to main/sbbs/master on Sunday, April 11, 2021 20:33:28
    https://gitlab.synchro.net/main/sbbs/-/commit/8b59ee66aa45470694ded86b
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Add format_name() method to format a filename for display

    It's a wrapper for filedat.c -> format_filename() which can truncate and pad a filename for display purposes.
  • From Rob Swindell to Git commit to main/sbbs/master on Monday, April 12, 2021 20:49:19
    https://gitlab.synchro.net/main/sbbs/-/commit/cc06b0b54b403549e83a268d
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix some memory leaks
  • From Rob Swindell to Git commit to main/sbbs/master on Tuesday, April 13, 2021 01:09:41
    https://gitlab.synchro.net/main/sbbs/-/commit/c487956b0d81725b50057cb2
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Check return value of JS_ValueToInt32()

    CID 331092
  • From Rob Swindell to Git commit to main/sbbs/master on Sunday, April 18, 2021 15:43:05
    https://gitlab.synchro.net/main/sbbs/-/commit/2eb90776e1b0c1845d21c516
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    remove() method needs to read message header (not just index)

    Or else it fails with the following base error:
    !smb_putmsghdr illegal header length increase: 70 (1 blocks, 0 hfields, 0 dfields) vs 0 (0 blocks)
  • From Rob Swindell to Git commit to main/sbbs/master on Sunday, April 18, 2021 17:01:43
    https://gitlab.synchro.net/main/sbbs/-/commit/e5ccdb106973f01eb85dd564
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    get_size() and get_path() methods need to read the header record too

    For files with names > 64 chars.
  • From Rob Swindell to Git commit to main/sbbs/master on Sunday, May 02, 2021 01:17:07
    https://gitlab.synchro.net/main/sbbs/-/commit/63a2631feccde997f9ddb0fc
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    JSDOC updates

    Finally document the file-meta-object properties now that things are solidifying.
  • From Rob Swindell to Git commit to main/sbbs/master on Sunday, May 02, 2021 01:43:45
    https://gitlab.synchro.net/main/sbbs/-/commit/24bf49ea8843706ebbc7dfc9
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Add a 'readd_always' option to the update() method

    This will cause archive file contents to be re-captured/added
  • From Rob Swindell to Git commit to main/sbbs/master on Wednesday, May 12, 2021 23:57:52
    https://gitlab.synchro.net/main/sbbs/-/commit/b3d55fd249366cd28d4bfc99
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    The optional JSON-metadata string property is now "metadata"

    The old "content" array property goes away.
  • From Rob Swindell to Git commit to main/sbbs/master on Wednesday, May 12, 2021 23:57:52
    https://gitlab.synchro.net/main/sbbs/-/commit/1c96d408344fc24113b40be7
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Allow the metadata property to be set with add() and update()

    Sorry for the impending imminent merge hassle Deuce!
  • From Rob Swindell to Git commit to main/sbbs/master on Thursday, May 13, 2021 00:06:54
    https://gitlab.synchro.net/main/sbbs/-/commit/2b047cf6edd3d3108107a5ac
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Don't populate metadata property unless there is metadata

    Or detail level is MAX.
  • From Rob Swindell to Git commit to main/sbbs/master on Saturday, January 15, 2022 20:11:53
    https://gitlab.synchro.net/main/sbbs/-/commit/3e5326e0e81d2497468e238c
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Correct JSDOCS for get_path, get_size, and get_time methods

    These methods also (optionally) accept a file-meta-object as an argument.
  • From Rob Swindell to Git commit to main/sbbs/master on Wednesday, January 19, 2022 00:09:12
    https://gitlab.synchro.net/main/sbbs/-/commit/2d033355aab58a6a6c78db5d
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix typo (wrong default size value) in JSDOCS for format_name()

    The default is 'size' parameter value is 12 characters, not 13.
  • From Rob Swindell to Git commit to main/sbbs/master on Tuesday, February 01, 2022 19:13:49
    https://gitlab.synchro.net/main/sbbs/-/commit/70898b5bbf5f1b993a0f1cfc
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    add() method will now parse added, last_downloaded, and times_downloaded

    These 3 'stats' properties were read-only (never used when adding a file). To support moving files between FileBases while retaining these stats, support the parse/use of these file-meta-object property values.

    Should fix issue #333 reported by Nightfox.
  • From Rob Swindell to Git commit to main/sbbs/master on Sunday, March 20, 2022 20:32:05
    https://gitlab.synchro.net/main/sbbs/-/commit/623c49e43906d3f86fb3c247
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    File's meta-object's "size" and "time" properties reflect current values

    Query the disk for file's current "size" and "time" values when get_list() or get() method is used with a "detail" level of >= DETAIL.NORMAL and the "check file existence" toggle option is enabled for this directory in SCFG.

    I pondered and contemplated whether this configuration setting should be checked/applied here or in the various JS scripts (e.g. filelist.js) and decided here was best to provide the most uniform/expected behavior, even though there is a performance impact. If a script doesn't need/use these properties, they should probably be specifying the DETAIL.MIN (minimal) detail level in their queries anyway, which will then bypass these performance-impacting disk queries.
  • From Rob Swindell (on Windows 11) to Git commit to main/sbbs/master on Sunday, December 24, 2023 17:33:28
    https://gitlab.synchro.net/main/sbbs/-/commit/41ace72c24800de0fa0b3b23
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix filebase corruption caused by FileBase.renew()

    echicken reported this problem: pretty severe filebase corruption as a result of calling FileBase.renew(). The problem seemed pretty obvious (only loading the file's index record), but I do think the underlying SMBLIB functions
    should be more resilient to misuse and not corrupt the base. So, that's still
    a TODO.

    No existing scripts were using FileBase.renew(), so this problem has gone unnoticed since SBBS v3.19.
  • From Rob Swindell (on Windows 11) to Git commit to main/sbbs/master on Monday, December 25, 2023 20:29:47
    https://gitlab.synchro.net/main/sbbs/-/commit/22d7343f21cbd9cee29a4118
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Rename the METADATA and metadata properties to AUXDATA and auxdata

    To eliminate confusion with the file-meta-object that this API deals with
    more than anything else.

    echicken's suggestion

    Nothing used this property before now, so this should be fine.
  • From Rob Swindell (on Windows 11) to Git commit to main/sbbs/master on Thursday, December 28, 2023 18:10:58
    https://gitlab.synchro.net/main/sbbs/-/commit/ad309d463528da40cfd32354
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix misuse of JSVAL_TO_DOUBLE() for "cost" and "size" file-meta-obj properties

    As pointed out by echicken: when setting the "cost" property to any value, the actual
    file's cost would be set to 9223372036854776000 regardless of what number was in the
    provided file metadata object. Most jsval numbers aren't doubles (they're ints) so
    need to use JS_ValueToNumber() to do the proper conversion, regardless of underlying
    type.

    Noticed the same problem with the "size" property.

    Thanks for the tests and report echicken!
  • From Rob Swindell (on Windows 11) to Git commit to main/sbbs/master on Friday, December 29, 2023 17:10:27
    https://gitlab.synchro.net/main/sbbs/-/commit/0dbd3f064a2dee66cca6c409
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix some apparent memory leaks when using file's auxdata

    Nobody's really using this auxdata yet, besides echicken, so no impact for others.
  • From Rob Swindell (on Windows 11) to Git commit to main/sbbs/master on Friday, December 29, 2023 17:10:27
    https://gitlab.synchro.net/main/sbbs/-/commit/831ddd710d935eee37639446
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    When FileBase.update() is called with readd_always=true, update date-added

    The use from addfiles.js (the -readd option) implies this is what's expected. And echicken was suprised the 'added' date/time-stamp wasn't udpated.
  • From Rob Swindell (on Debian Linux) to Git commit to main/sbbs/master on Monday, June 17, 2024 20:38:51
    https://gitlab.synchro.net/main/sbbs/-/commit/946e42d6fc4e56de23c8c664
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    FileBase.add() now supports override to *never* extract/use DIZ if desired

    Working on fileman.js, when moving files to another base, the output of unzip (trying to extra a FILE_ID.DIZ) was corrupting the display. We don't really want a DIZ file to get imported when moving files between bases anyway.

    So the second parameter to FileBase.add() can be either:
    - undefined: will try to extract/use DIZ only if there's no ext desc already
    - true: will try to extract/use a DIZ even if there's an ext desc already
    - false: will never try to extract/use a DIZ

    If the directory is not configured for DIZ support, then the DIZ extraction/use will never occur under any condition.
  • From Rob Swindell (on Debian Linux) to Git commit to main/sbbs/master on Monday, June 17, 2024 20:38:51
    https://gitlab.synchro.net/main/sbbs/-/commit/35cde60c2a947b8a5e2ce2c4
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Better JSDOC description of use_diz param to FileBase.add()
  • From Rob Swindell (on Windows 11) to Git commit to main/sbbs/master on Thursday, June 20, 2024 15:00:05
    https://gitlab.synchro.net/main/sbbs/-/commit/32e880895b1acec254d426ad
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix 64-char filename length limit for FileBase.get[_path/size/time] methods

    This was only a problem when these methods were passed a file-meta-object instead of the file name. In hindsight, that's kind of a dumb API "feature" since we're just parsing the name property out of the object.

    The file_t.file_idx.name is limited to 64 chars, so don't use that struct element to store the parsed "name" property of the passed file-meta-object.
  • From Rob Swindell (on Debian Linux) to Git commit to main/sbbs/master on Friday, June 21, 2024 00:26:42
    https://gitlab.synchro.net/main/sbbs/-/commit/f532bee963c7e7fb6df4fc77
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix bug with FileBase.get_time() for filenames > 64 chars in length

    We need to read the file header (not just index) entry to get the actual
    full filename.

    Also, removed some extraneous calls to getfilepath() that served no
    purposed.
  • From Rob Swindell (on Debian Linux) to Git commit to main/sbbs/master on Friday, June 21, 2024 12:45:08
    https://gitlab.synchro.net/main/sbbs/-/commit/726a08527c590b38136b7ef7
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Fix new small memory leak (no need to use strdup here)

    Fix CID 497098
  • From Rob Swindell (on Debian Linux) to Git commit to main/sbbs/master on Friday, September 13, 2024 20:08:11
    https://gitlab.synchro.net/main/sbbs/-/commit/2fc23c32c4b0b19685f2cb0e
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    FileBase.update() method throws more exceptions upon error

    This will help to determine cause of any file update (e.g. rename)
    failures, as reported by Nelgin.
  • From Rob Swindell (on Debian Linux) to Git commit to main/sbbs/master on Friday, September 13, 2024 20:45:33
    https://gitlab.synchro.net/main/sbbs/-/commit/397d6ebe5b0185bdff5c0c59
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Don't allow FileBase.update() to create a duplicate file

    FileBase.update() will now throw an exception if attempting to rename a file
    to a filename that already exists in the filebase index.

    Prior to this change, one could (via JS methods) rename a file in the base to create a duplicate filename which would corrupt the base (one index entry and two header records for the same filename).
  • From Rob Swindell (on Windows 11) to Git commit to main/sbbs/master on Monday, September 16, 2024 18:52:34
    https://gitlab.synchro.net/main/sbbs/-/commit/2391c3c9a3912622b8016333
    Modified Files:
    src/sbbs3/js_filebase.c
    Log Message:
    Update JSDOC description of update() method

    Clarify that this is the method to use to rename a file.