Skip to content

feat(file-management): add symbolic link import action#771

Open
sebbeke wants to merge 2 commits into
Listenarrs:canaryfrom
sebbeke:feature/symlink-import
Open

feat(file-management): add symbolic link import action#771
sebbeke wants to merge 2 commits into
Listenarrs:canaryfrom
sebbeke:feature/symlink-import

Conversation

@sebbeke

@sebbeke sebbeke commented Jul 19, 2026

Copy link
Copy Markdown

Summary

Adds a configurable Symbolic Link completed-file action for virtual, remote, and FUSE-backed storage workflows.

This allows Listenarr to import audiobooks without copying their contents locally when the source is exposed through systems such as NZBDav, rclone, Zurg, or other mounted storage providers.

This addresses the use case discussed in Discussion #334, where hardlinks are not possible because the source and destination are located on different filesystems.

Changes

Added

  • Added a new Symbolic Link file action to the backend.
  • Added the corresponding option to the frontend file-management settings.
  • Added support for regular source files and existing symbolic links.
  • Added handling for both absolute and relative symbolic-link targets.
  • Added tests covering successful and failed symbolic-link imports.

Changed

  • Existing source symlinks are resolved so the library entry can point directly to the underlying target instead of creating an unnecessary chain of links.
  • Symbolic-link imports keep the source file under the control of the download client.
  • Destination links are created safely to reduce the risk of replacing a valid existing file when link creation fails.

Motivation

The existing Hardlink/Copy action is not suitable for workflows where completed downloads are exposed through a separate filesystem, such as an rclone or WebDAV FUSE mount.

In those environments:

  1. Creating a hardlink fails because the source and destination are on different filesystems.
  2. Listenarr falls back to copying the file.
  3. The entire virtual audiobook is read from the remote provider and stored locally.

The new action creates a symbolic link instead, avoiding the full copy while still allowing applications such as Audiobookshelf to access the audiobook through the mounted source.

Example:

/data/media/audiobooks/Author/Book/book.m4b
    -> /data/debrid/torrents/Book/book.m4b

Supported workflows

This implementation is intended to support workflows including:

  • NZBDav with rclone
  • Real-Debrid with RDTClient and Zurg/rclone
  • WebDAV and FUSE-mounted storage
  • Other virtual filesystems that expose stable local paths

The symbolic-link target must remain available for the imported audiobook to remain accessible. Applications consuming the library must also have access to the target under the same absolute path.

Testing

The implementation was tested for:

  • importing a regular source file as a symbolic link;
  • preserving an existing absolute symbolic-link target;
  • resolving an existing relative symbolic-link target;
  • keeping the original source file or link intact;
  • handling an existing destination;
  • cleaning up after failed link creation;
  • ensuring symbolic-link imports do not fall back to copying file contents.

Notes

Related discussion: #334

Parts of this implementation were developed with AI assistance. All AI-assisted changes were reviewed and adjusted before committing, and the resulting implementation was tested against the scenarios described above.

Sebastiaan Jacobs added 2 commits July 19, 2026 23:30
Add a configurable symbolic link file action for virtual and FUSE-backed storage workflows.

Preserve existing symlink targets during import, avoid copying file contents, and keep source files under downloader control. Expose the new action in the frontend and add coverage for regular files, absolute links, relative links, and failed imports.

Supports use cases discussed in Listenarr Discussion Listenarrs#334, including NZBDav, rclone, FUSE, and Real-Debrid mounted storage.

Parts of this implementation were developed with the assistance of AI. All generated changes were reviewed, adjusted, and tested before committing.
Build the custom Listenarr image with GitHub Actions and publish it to GitHub Container Registry for linux/amd64.
@sebbeke
sebbeke requested a review from a team July 19, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant