Skip to main content
Version: 3.1.0

Storage Path Tag Collision, Unreadable Upload Errors & FTP Proof Location

Version: 3.1.0 Date: 2026-06-12

Goal: Fix corrupted destination file names on storage upload. With the FTP default storagePath (#file_directory/#file_name_with_hash), uploaded files were named <dir>/<file>_with_hash (e.g. enable-debug.txt_with_hash) instead of <dir>/<file>_<hash>.<ext>. Present since 2.0.0 (Oct 2024).

Solution: Tags were substituted in array order with replaceAll, so a tag that is a prefix of another corrupted the longer one (#file_name consumed the start of #file_name_with_hash; same latent issue between #timestamp and #timestamp_day). Substitute tags ordered by descending length so longer tags resolve first.

Implementation Details:

  • Sort replacement tags by descending tag.length before the reduce.
  • Unit tests cover the prefix-collision class (#file_name vs #file_name_with_hash, #timestamp vs #timestamp_day).

Related fixes:

  • Unreadable upload error ("[object Object]") — format each rejection reason explicitly (message for Error, raw string, or JSON fallback) via a formatReason helper instead of relying on implicit stringification in join.
  • FTP proof uploaded to the wrong location — derive the proof name from the resolved storagePath (keep directory, drop the local work folder prefix, append -proof.zip) instead of using join(workFolder, ...).

Files Modified:

  • src/protocol/storage/storage.service.ts — sort tags by length before substitution; formatReason helper + typed rejected filter; derive FTP proof name from storage path
  • src/protocol/storage/storage.service.spec.tsgetStoragePath tests (tag collision + nominal FTP/git), sendProof FTP placement test
  • test/DESIRED.md — add "Storage path naming" scenarios
  • test/STATUS.md — document storage path naming unit coverage