mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
[PR #5775] [CLOSED] Work around symbolic link issue on Linux #10654
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/5775
Author: @Orochimarufan
Created: 4/11/2021
Status: ❌ Closed
Base:
master← Head:unixfile📝 Commits (1)
f782dc3Add UnixPhysicalFileResultExecutor📊 Changes
3 files changed (+136 additions, -0 deletions)
View changed files
📝
Jellyfin.Server/Jellyfin.Server.csproj(+5 -0)➕
Jellyfin.Server/Middleware/UnixPhysicalFileResultExecutor.cs(+122 -0)📝
Jellyfin.Server/Startup.cs(+9 -0)📄 Description
In 10.7.x the direct file streams were switched to PhysicalFileResult. This has introduced a regression because System.IO.FileInfo (and by extension PhysicalFileResultExecutor) don't handle symbolic links correctly.
More specifically, System.IO.FileInfo will report the symlink size instead of the target size. This means PhysicalFileResultExecutor will only ever try to send a few bytes of a symlinked file.
The fix for the upstream issue has been moved back to .NET 6 so it would be nice to work around the regression in the mean time.
This is a working replacement for PhysicalFileResultExecutor based on Mono.Posix which has proper handling of symbolic links. However, it does introduce an additional dependency. It has been tested on amd64 and aarch64 Linux. I'd expect it to work just as well on macOS, provided the platform check is extended, but I have no means of verifying this claim.
An analogous solution might also be viable on Windows, but I don't know enough about Win32 to take a shot at it.
Alternatively, it may be possible to achieve a similar effect using the open-seek-tell workaround.
Note that this is my first time working with ASP.NET, so I'd welcome suggestions.
Changes
Add custom ResultExecutor for PhysicalFileResult based on Mono.Posix
Issues
Fixes #5521 on Linux
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.