droppyjs / droppy

Self-hosted file storage
BSD 2-Clause "Simplified" License
104 stars 12 forks source link

fix symlinks #89

Closed vahtos closed 5 months ago

vahtos commented 5 months ago

See https://github.com/silverwind/droppy/pull/442 for context. I tested these changes and they work, with this commit symlinks will now work.

This is my first contribution, and I am still getting familiar with the project. Please let me know if there is an up to date documentation for contributing and testing.

vahtos commented 5 months ago

6a9f951 requires bumping the required version of node to 14.14.0. Without this change, the previous behavior was failing to delete the symlink on disk, but showing it as gone in the application. With this change, the symlink is deleted, and the linked directory is preserved.

It's probably also worthwhile to de-clutter utils.js a bit by removing utils.rmdir() since it's only used once, and isn't a helpful abstraction over fs.rm(). utils.rm() could also be adjusted to use fs.rm() for consistency. I'm not sure what the nuances are between using fs.unlink() and fs.rm().