90 Commits

Author SHA1 Message Date
gnattu
1a7c2299c6 Catch IOExceptions for GetFileSystemMetadata
Our `GetFileSystemEntries` method will throw when enumerating the file system, but its callers might consider the unhandled exceptions as the whole path is not available. This would cause a single problematic file to fail the enumeration, and could lead to unexpected side effects.

HandleIOException gracefully by marking the files throwing as not exist to let the caller skip that file.
2025-01-19 00:40:13 +08:00
Tim Eisele
c56dbc1c44
Enhance Trickplay (#11883) 2024-09-07 11:23:48 -06:00
Bond-009
c666f9d050
Use real temp dir instead of cache dir for temp files (#12226) 2024-07-15 08:44:14 -04:00
Shadowghost
6734450d40 Backport pull request #12025 from jellyfin/release-10.9.z
Fix empty image folder removal for legacy locations

Original-merge: 476dc01f4d5bf0fdf391935ef0759b0583bf7026

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
2024-06-24 20:28:58 -04:00
gnattu
5ac518b02a Backport pull request #11570 from jellyfin/release-10.9.z
Fix absolute path checking on windows

Original-merge: 6689d837d6dcfa0925efdbd9c76a7e1fe4f7cc54

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
2024-05-13 12:47:35 -04:00
Claus Vium
239727e896
fix: skip library folders that are inaccessible or empty (#9291) 2024-03-18 09:09:00 -06:00
Stepan Goremykin
8d7e4229ca Merge branch 'master' into fix-resharper-warnings
# Conflicts:
#	Emby.Server.Implementations/Net/SocketFactory.cs
#	RSSDP/SsdpCommunicationsServer.cs
#	RSSDP/SsdpDeviceLocator.cs
#	RSSDP/SsdpDevicePublisher.cs
2023-10-12 20:11:16 +02:00
Stepan Goremykin
8ea812b65d Reduce string literal length by using verbatim string 2023-10-08 00:26:12 +02:00
Bond_009
b176beb88e Reduce string allocations
Some simple changes to reduce the number of allocated strings
2023-10-06 01:04:25 +02:00
Patrick Barron
78e00578c2 Use DI for IFileSystem 2023-10-03 10:25:14 -04:00
Bond_009
767a42fbdb Minor LibraryMonitor improvements
* Enable nullable
* Add a fast return to ReportFileSystemChanged when path should be ignored
* Use Span overloads of Path.* functions where possible
* IFileSystem: remove NormalizePath as Path.TrimEndingDirectorySeparator already checks if it's a root path
2023-09-13 17:30:50 +02:00
Ronan Charles-Lorel
4dc87a6f93
Align indentation on bottom brace of new list
Should stop error SA1137 in debug build
2023-07-01 03:37:18 +02:00
Ronan Charles-Lorel
c21140eeb5
Formatting
Fixes debug build?

Co-authored-by: Bond-009 <bond.009@outlook.com>
2023-07-01 03:24:19 +02:00
Ronan Charles-Lorel
07c142d5bd
Moving invalid chars list at class level with a better name 2023-06-29 16:04:45 +02:00
Ronan Charles-Lorel
46763b7661
Remove call to Path.GetInvalidFileNameChars
Superseded by a static char list to avoid platform-dependent issues
2023-06-29 15:21:39 +02:00
Ronan Charles-Lorel
e108183b13
Merge branch 'jellyfin:master' into master 2023-06-29 15:08:52 +02:00
Bond-009
756ee38d01
Remove ExtendedFileSystemInfo (#9749) 2023-05-10 17:39:57 -06:00
Ronan Charles-Lorel
31ac861b85
Formatting 2023-01-31 15:47:47 +01:00
Ronan Charles-Lorel
a2ac791bb7
Add a way to add more invalid characters when sanitizing a filename 2023-01-31 15:20:57 +01:00
Bond_009
b366dc2e6e Use ArgumentException.ThrowIfNullOrEmpty 2022-12-07 16:43:59 +01:00
Bond_009
52194f56b5 Replace != null with is not null 2022-12-05 15:01:13 +01:00
Joshua M. Boniface
3515c76ca1 Merge pull request #7724 from jtcasper/perms
(cherry picked from commit 884a59da07420708774eed25286950b14153c3dd)
Signed-off-by: Joshua Boniface <joshua@boniface.me>
2022-05-20 23:49:38 -04:00
Cody Robibero
1b3e56bae3 Split DirectoryExists and FileExists 2022-03-02 19:55:44 -07:00
Cody Robibero
fc5c6c0404 Use IFileSystem 2022-02-28 17:14:33 -07:00
Bond_009
1c14c86b20 Fix some warnings 2022-02-14 14:46:04 +01:00
Bond_009
ea8f40e84a More cleanup 2021-12-27 14:20:05 +00:00
Bond_009
4dfb7b18ae Add some docs and tests 2021-11-07 22:32:08 +01:00
Bond_009
0f52896691 Fix UnauthorizedAccessException in GetDrives
```
[15:01:24] [ERR] [55] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL GET /Environment/Drives.
System.UnauthorizedAccessException: Access to the path is denied.
 ---> System.IO.IOException: Operation not permitted
   --- End of inner exception stack trace ---
   at System.IO.DriveInfo.CheckStatfsResultAndThrowIfNecessary(Int32 result)
   at System.IO.DriveInfo.get_TotalSize()
   at Emby.Server.Implementations.IO.ManagedFileSystem.<>c.<GetDrives>b__32_0(DriveInfo d) in /home/bond/dev/jellyfin/Emby.Server.Implementations/IO/ManagedFileSystem.cs:line 583
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.ToList()
   at Emby.Server.Implementations.IO.ManagedFileSystem.GetDrives() in /home/bond/dev/jellyfin/Emby.Server.Implementations/IO/ManagedFileSystem.cs:line 583
   at Jellyfin.Api.Controllers.EnvironmentController.GetDrives() in /home/bond/dev/jellyfin/Jellyfin.Api/Controllers/EnvironmentController.cs:line 153
   at lambda_method559(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
```
2021-11-07 15:33:39 +01:00
Patrick Barron
c09ef74b51 Fix warnings in IO 2021-10-03 21:41:22 -04:00
Bond_009
a4eede29ab Use RandomAccess instead of a FileStream where it makes sense 2021-09-25 20:17:12 +02:00
Fernando Fernández
3d0b1ccae6
Remove all unused usings 2021-09-06 21:15:30 +02:00
Claus Vium
74fef6c05b
Merge pull request #6177 from Bond-009/async
Use async FileStreams where it makes sense
2021-09-06 13:55:34 +02:00
Bond_009
637e86478f Fix some warnings 2021-09-03 19:32:11 +02:00
Bond_009
e3dac4fda2 Use async FileStreams where it makes sense 2021-09-02 14:02:04 +02:00
Bond_009
8528e9bddb Improve platform checks 2021-07-12 20:21:51 +02:00
Bond_009
6f8ccab788 Move non-jellyfin extensions to separate project 2021-06-19 18:04:46 +02:00
cvium
42a2cc1747 Remove some unnecessary allocations 2021-05-24 00:30:41 +02:00
Bond_009
7e8428e588 Enable nullable reference types for Emby.Server.Implementations 2021-05-20 22:48:53 +02:00
Bond_009
c608d5104d Fix scanning 2021-05-01 15:56:16 +02:00
Bond_009
33327aa1a9 Improve fast path of ManagedFileSystem.GetValidFilename
|                      Method |          Data |        Mean |     Error |    StdDev |      Median |  Gen 0 | Gen 1 | Gen 2 | Allocated |
|---------------------------- |-------------- |------------:|----------:|----------:|------------:|-------:|------:|------:|----------:|
|       GetValidFilenameBench |    AC/DCKD/A |    52.29 ns |  0.537 ns |  0.448 ns |    52.35 ns | 0.0255 |     - |     - |      80 B |
|    GetValidFilenameOldBench |    AC/DCKD/A |    86.68 ns |  1.205 ns |  1.127 ns |    86.33 ns | 0.0587 |     - |     - |     184 B |
|    GetValidFilenameWinBench |    AC/DCKD/A |   448.55 ns |  1.228 ns |  1.088 ns |   448.33 ns | 0.0505 |     - |     - |     160 B |
| GetValidFilenameOldWinBench |    AC/DCKD/A |   865.21 ns |  5.734 ns |  5.083 ns |   866.60 ns | 0.0839 |     - |     - |     264 B |
|       GetValidFilenameBench | ValidFileName |    16.00 ns |  0.234 ns |  0.207 ns |    16.02 ns | 0.0102 |     - |     - |      32 B |
|    GetValidFilenameOldBench | ValidFileName |   100.66 ns |  1.255 ns |  1.174 ns |   101.21 ns | 0.0587 |     - |     - |     184 B |
|    GetValidFilenameWinBench | ValidFileName |   116.60 ns |  1.624 ns |  1.519 ns |   116.88 ns | 0.0356 |     - |     - |     112 B |
| GetValidFilenameOldWinBench | ValidFileName | 1,052.66 ns | 18.077 ns | 33.056 ns | 1,037.25 ns | 0.0839 |     - |     - |     264 B |
2021-04-22 12:31:47 +02:00
Bond_009
81209258ab ManagedFileSystem: Rewrite GetValidFilename and more improvements 2021-04-22 03:11:21 +02:00
Claus Vium
f99237cf9b
Update Emby.Server.Implementations/IO/ManagedFileSystem.cs
Co-authored-by: Cody Robibero <cody@robibe.ro>
2021-04-10 00:16:37 +02:00
cvium
1a3352003d don't die on dangling symlinks 2021-04-09 23:02:36 +02:00
Bond_009
c533b20496 Remove ManagedFileSystem.IsRootPath
`Path.IsPathRooted` should be used instead
2021-04-01 19:39:00 +02:00
crobibero
8d902478a0 Don't skip hidden files 2021-02-02 07:14:11 -07:00
Gary Wilber
1fdeac0a7d Ignore inaccessible files during library scans 2020-12-31 18:40:24 -08:00
Bond_009
e653eef44f Fix some warnings 2020-08-31 22:20:19 +02:00
Ken
eea142cad1
FullName property instead of ToString in Emby.Server.Implementations/IO/ManagedFileSystem.cs
Co-authored-by: Cody Robibero <cody@robibe.ro>
2020-07-18 19:40:28 -06:00
Ken
d719ca78b4
Spacing standard on Emby.Server.Implementations/IO/ManagedFileSystem.cs
Co-authored-by: Cody Robibero <cody@robibe.ro>
2020-07-18 19:39:31 -06:00
Ken Brazier
6a39b1a4ca Merge 'master' updates into 2354-soft-link-sizes 2020-07-18 11:39:53 -06:00