mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
Add first test
This commit is contained in:
@@ -2,14 +2,9 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="../../SharedVersion.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
||||
@@ -22,9 +17,15 @@
|
||||
<ProjectReference Include="../../MediaBrowser.Controller/MediaBrowser.Controller.csproj" />
|
||||
<ProjectReference Include="../Jellyfin.MediaEncoding.Keyframes/Jellyfin.MediaEncoding.Keyframes.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
||||
<_Parameter1>Jellyfin.MediaEncoding.Hls.Tests</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -176,12 +176,18 @@ namespace Jellyfin.MediaEncoding.Hls.Playlist
|
||||
|
||||
internal static bool IsExtractionAllowedForFile(ReadOnlySpan<char> filePath, string[] allowedExtensions)
|
||||
{
|
||||
var extension = Path.GetExtension(filePath);
|
||||
if (extension.IsEmpty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove the leading dot
|
||||
var extension = Path.GetExtension(filePath)[1..];
|
||||
var extensionWithoutDot = extension[1..];
|
||||
for (var i = 0; i < allowedExtensions.Length; i++)
|
||||
{
|
||||
var allowedExtension = allowedExtensions[i];
|
||||
if (extension.Equals(allowedExtension, StringComparison.OrdinalIgnoreCase))
|
||||
if (extensionWithoutDot.Equals(allowedExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user