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.lengthbefore thereduce. - Unit tests cover the prefix-collision class (
#file_namevs#file_name_with_hash,#timestampvs#timestamp_day).
Related fixes:
- Unreadable upload error ("[object Object]") — format each rejection reason explicitly (
messageforError, raw string, or JSON fallback) via aformatReasonhelper instead of relying on implicit stringification injoin. - 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 usingjoin(workFolder, ...).
Files Modified:
src/protocol/storage/storage.service.ts— sort tags by length before substitution;formatReasonhelper + typedrejectedfilter; derive FTP proof name from storage pathsrc/protocol/storage/storage.service.spec.ts—getStoragePathtests (tag collision + nominal FTP/git),sendProofFTP placement testtest/DESIRED.md— add "Storage path naming" scenariostest/STATUS.md— document storage path naming unit coverage