Files
DumbDrop/test/path-validation.test.js
abite c574310d86 fix: resolve file disappearance with Docker bind mounts
(#73)

* fix: resolve file disappearance with Docker bind mounts

Files were disappearing when using bind mounts because fs.realpathSync()
requires files to exist. Updated path validation to use path.resolve()
for non-existing files (during upload) and fs.realpathSync() only for
existing files (during operations).

- Add isPathWithinUploadDir() to fileUtils with requireExists parameter
- Update files.js to use shared validation function
- Add path validation to upload.js for all file operations
- Add comprehensive test suite (16 tests, all passing)
- Maintain security against path traversal attacks
- Full backward compatibility with named volumes

Fixes: Files disappearing with bind mounts
Related: d69a8b2, fc8bff9"

* Improve file existence check in isPathWithinUploadDir

Refines logic to immediately return false if requireExists is true and the file does not exist, ensuring more robust handling of non-existent files.

* Bump version to 1.0.1

Update package version from 1.0.0 to 1.0.1 in preparation for a new release.
2025-11-09 20:36:24 -08:00

5.7 KiB