mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-31 14:33:54 -04:00
Remove ResourceFileManager (#4567)
This commit is contained in:
parent
41b3a7869e
commit
6676ca4d1b
@ -640,7 +640,6 @@ namespace Emby.Server.Implementations
|
|||||||
|
|
||||||
ServiceCollection.AddSingleton<ISubtitleEncoder, MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder>();
|
ServiceCollection.AddSingleton<ISubtitleEncoder, MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder>();
|
||||||
|
|
||||||
ServiceCollection.AddSingleton<IResourceFileManager, ResourceFileManager>();
|
|
||||||
ServiceCollection.AddSingleton<EncodingHelper>();
|
ServiceCollection.AddSingleton<EncodingHelper>();
|
||||||
|
|
||||||
ServiceCollection.AddSingleton<IAttachmentExtractor, MediaBrowser.MediaEncoding.Attachments.AttachmentExtractor>();
|
ServiceCollection.AddSingleton<IAttachmentExtractor, MediaBrowser.MediaEncoding.Attachments.AttachmentExtractor>();
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using MediaBrowser.Controller;
|
|
||||||
using MediaBrowser.Controller.Net;
|
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations
|
|
||||||
{
|
|
||||||
public class ResourceFileManager : IResourceFileManager
|
|
||||||
{
|
|
||||||
private readonly IFileSystem _fileSystem;
|
|
||||||
private readonly ILogger<ResourceFileManager> _logger;
|
|
||||||
|
|
||||||
public ResourceFileManager(ILogger<ResourceFileManager> logger, IFileSystem fileSystem)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_fileSystem = fileSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetResourcePath(string basePath, string virtualPath)
|
|
||||||
{
|
|
||||||
var fullPath = Path.Combine(basePath, virtualPath.Replace('/', Path.DirectorySeparatorChar));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fullPath = Path.GetFullPath(fullPath);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error retrieving full path");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't allow file system access outside of the source folder
|
|
||||||
if (!_fileSystem.ContainsSubPath(basePath, fullPath))
|
|
||||||
{
|
|
||||||
throw new SecurityException("Access denied");
|
|
||||||
}
|
|
||||||
|
|
||||||
return fullPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller
|
|
||||||
{
|
|
||||||
public interface IResourceFileManager
|
|
||||||
{
|
|
||||||
string GetResourcePath(string basePath, string virtualPath);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user