LibrePhotos / librephotos

A self-hosted open source photo management service. This is the repository of the backend.
MIT License
6.97k stars 306 forks source link

Follow symlinks when scanning a directory and when choosing a directory #98

Open derneuere opened 3 years ago

derneuere commented 3 years ago

Currently, the program does not follow symlink. We have to implemented at the following places.

https://github.com/LibrePhotos/librephotos/blob/5635433012bc80a2a7046f2c6f77dc503213c1b5/api/directory_watcher.py#L130-L134 Should use this when scanning: https://stackoverflow.com/questions/3771696/python-os-walk-follow-symlinks

https://github.com/LibrePhotos/librephotos/blob/5635433012bc80a2a7046f2c6f77dc503213c1b5/api/api_util.py#L47-L54 This is called when choosing a directory. Should also follow symlinks.

derneuere commented 3 years ago

path_to_dict does not yet follow symlinks

rafntor commented 3 years ago

To support symlink scanning, isn't this all it takes after os.path.join (?) ;

if os.path.islink(fpath): fpath = os.readlink(fpath)

https://github.com/LibrePhotos/librephotos/blob/f99027a66ea62d304d838fb6e0a68a65fc3e08c9/api/directory_watcher.py#L170-L174