Commit graph

63 commits

Author SHA1 Message Date
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
telans 247f9c61e6
fix SA1513/SA1516 2020-06-16 16:11:30 +12:00
telans acd4389653
fix SA1005 2020-06-15 10:41:00 +12:00
crobibero 44957c5a9a Use typed logger where possible 2020-06-05 18:15:56 -06:00
Ken Brazier 36312c92f5 2354 open soft-links to read size 2020-05-31 16:40:02 -06:00
Bond_009 e9d1eabd53 Remove unused usings 2020-03-24 16:12:06 +01:00
Bond_009 07cc4be6a7 Fix some warnings
* Add analyzers to MediaBrowser.XbmcMetadata
* Enable TreatWarningsAsErrors for MediaBrowser.XbmcMetadata
* Add analyzers to MediaBrowser.WebDashboard
* Enable TreatWarningsAsErrors for MediaBrowser.WebDashboard
* Disable SA1600 in favor of CS1591
2020-02-23 12:11:43 +01:00
Bond-009 c8409d2ea1 Remove FileSystem.GetStream 2020-01-22 22:20:35 +01:00
dkanada 9eac19c75a change invariant culture to ordinal 2020-01-13 17:09:22 +09:00
dkanada 65e9a705d3 check operating system for absolute path test 2020-01-13 15:34:50 +09:00
dkanada a8cd963d46 fix tests for absolute paths 2020-01-13 15:25:54 +09:00
Bond_009 bb236b9591 Merge branch 'master' into warn12 2020-01-10 21:18:16 +01:00
Anthony Lavado 75f19a762c Re-order the path statement to avoid file issues
Fixes #31874.
2020-01-08 04:05:07 -05:00
Bond_009 2ef4ffd698 More warnings (removed) 2019-12-11 00:13:57 +01:00
Bond_009 42ffddc269 Fix more warnings 2019-11-27 16:29:56 +01:00
Bond-009 6032f31aa6 Use CultureInvariant string conversion for Guids 2019-08-09 23:17:54 +02:00
Bond_009 aa30227545 Improve main code flow
Improved the way how some parts of the code depend on eachother
Fixed some style issues
2019-06-09 23:51:52 +02:00
dkanada b768ad978e split the new command to more than one line 2019-06-02 21:49:12 -07:00
dkanada 4a9b349c04 only return useful drives 2019-05-16 16:45:56 -07:00
Bond_009 f911fda34f Merge ifs 2019-03-29 20:34:42 +01:00
Bond_009 41df562419 Improve IO code
* Style changes
* Remove remnants of SMB support
* Use `GetInvalidFileNameChars` instead of rolling our own
* Remove possible unexpected behaviour with async file streams
* Remove some dead code
2019-03-28 23:26:43 +01:00
Bond-009 decaffed86 Remove EnvironmentInfo
This moved the last bit of usefulness of EnvironmentInfo into a static
class.
2019-03-07 22:41:41 +01:00
Bond-009 c5fce647de Cleanup/simplification
* Removed useless copies/allocations
* Reduced unneeded complexity
2019-03-07 21:13:13 +01:00
William Taylor 18ae107ce4 Removed unnecessary configuration options and reduced primitive dependencies 2019-02-17 14:09:52 +00:00
William Taylor 0d5fbcb031 Removed primitives from services in Program.cs
This will make it easier to move dependency registration
to a system without having to new up all the services first.
Moved the primitives to an IConfiguration which is much easier to inject.
2019-02-17 14:08:52 +00:00
Erwin de Haan d3afa53191 Final refactored IFileSystem and ManagedFileSystem 2019-01-28 22:10:52 +01:00
Andrew Rabert 803bf563d7 Merge pull request #621 from Bond-009/perf
Minor improvements to library scan code
2019-01-20 18:13:49 -05:00
William Taylor 65cd3ed597 Replaced injections of ILogger with ILoggerFactory
This makes resolving dependencies from the container much easier as
you cannot resolve with primitives parameters in a way that is any
more readable.

The aim of this commit is to change as little as possible with the end
result, loggers that were newed up for the parent object were given the same
name. Objects that used the base or app loggers, were given a new logger with
an appropriate name.

Also removed some unused dependencies.
2019-01-20 21:05:12 +00:00