mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 22:07:13 -04:00
Merge pull request #7076 from crobibero/providerid
This commit is contained in:
commit
1725b2ee69
@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
var attributeEnd = attributeIndex + attribute.Length;
|
var attributeEnd = attributeIndex + attribute.Length;
|
||||||
if (attributeIndex > 0
|
if (attributeIndex > 0
|
||||||
&& str[attributeIndex - 1] == '['
|
&& str[attributeIndex - 1] == '['
|
||||||
&& str[attributeEnd] == '=')
|
&& (str[attributeEnd] == '=' || str[attributeEnd] == '-'))
|
||||||
{
|
{
|
||||||
var closingIndex = str[attributeEnd..].IndexOf(']');
|
var closingIndex = str[attributeEnd..].IndexOf(']');
|
||||||
// Must be at least 1 character before the closing bracket.
|
// Must be at least 1 character before the closing bracket.
|
||||||
|
@ -8,13 +8,17 @@ namespace Jellyfin.Server.Implementations.Tests.Library
|
|||||||
{
|
{
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("Superman: Red Son [imdbid=tt10985510]", "imdbid", "tt10985510")]
|
[InlineData("Superman: Red Son [imdbid=tt10985510]", "imdbid", "tt10985510")]
|
||||||
|
[InlineData("Superman: Red Son [imdbid-tt10985510]", "imdbid", "tt10985510")]
|
||||||
[InlineData("Superman: Red Son - tt10985510", "imdbid", "tt10985510")]
|
[InlineData("Superman: Red Son - tt10985510", "imdbid", "tt10985510")]
|
||||||
[InlineData("Superman: Red Son", "imdbid", null)]
|
[InlineData("Superman: Red Son", "imdbid", null)]
|
||||||
[InlineData("Superman: Red Son", "something", null)]
|
[InlineData("Superman: Red Son", "something", null)]
|
||||||
[InlineData("Superman: Red Son [imdbid1=tt11111111][imdbid=tt10985510]", "imdbid", "tt10985510")]
|
[InlineData("Superman: Red Son [imdbid1=tt11111111][imdbid=tt10985510]", "imdbid", "tt10985510")]
|
||||||
|
[InlineData("Superman: Red Son [imdbid1-tt11111111][imdbid=tt10985510]", "imdbid", "tt10985510")]
|
||||||
[InlineData("Superman: Red Son [tmdbid=618355][imdbid=tt10985510]", "imdbid", "tt10985510")]
|
[InlineData("Superman: Red Son [tmdbid=618355][imdbid=tt10985510]", "imdbid", "tt10985510")]
|
||||||
[InlineData("Superman: Red Son [tmdbid=618355][imdbid=tt10985510]", "tmdbid", "618355")]
|
[InlineData("Superman: Red Son [tmdbid-618355][imdbid-tt10985510]", "imdbid", "tt10985510")]
|
||||||
|
[InlineData("Superman: Red Son [tmdbid-618355][imdbid-tt10985510]", "tmdbid", "618355")]
|
||||||
[InlineData("[tmdbid=618355]", "tmdbid", "618355")]
|
[InlineData("[tmdbid=618355]", "tmdbid", "618355")]
|
||||||
|
[InlineData("[tmdbid-618355]", "tmdbid", "618355")]
|
||||||
[InlineData("tmdbid=111111][tmdbid=618355]", "tmdbid", "618355")]
|
[InlineData("tmdbid=111111][tmdbid=618355]", "tmdbid", "618355")]
|
||||||
[InlineData("[tmdbid=618355]tmdbid=111111]", "tmdbid", "618355")]
|
[InlineData("[tmdbid=618355]tmdbid=111111]", "tmdbid", "618355")]
|
||||||
[InlineData("tmdbid=618355]", "tmdbid", null)]
|
[InlineData("tmdbid=618355]", "tmdbid", null)]
|
||||||
@ -23,6 +27,8 @@ namespace Jellyfin.Server.Implementations.Tests.Library
|
|||||||
[InlineData("tmdbid=", "tmdbid", null)]
|
[InlineData("tmdbid=", "tmdbid", null)]
|
||||||
[InlineData("tmdbid", "tmdbid", null)]
|
[InlineData("tmdbid", "tmdbid", null)]
|
||||||
[InlineData("[tmdbid=][imdbid=tt10985510]", "tmdbid", null)]
|
[InlineData("[tmdbid=][imdbid=tt10985510]", "tmdbid", null)]
|
||||||
|
[InlineData("[tmdbid-][imdbid-tt10985510]", "tmdbid", null)]
|
||||||
|
[InlineData("Superman: Red Son [tmdbid-618355][tmdbid=1234567]", "tmdbid", "618355")]
|
||||||
public void GetAttributeValue_ValidArgs_Correct(string input, string attribute, string? expectedResult)
|
public void GetAttributeValue_ValidArgs_Correct(string input, string attribute, string? expectedResult)
|
||||||
{
|
{
|
||||||
Assert.Equal(expectedResult, PathExtensions.GetAttributeValue(input, attribute));
|
Assert.Equal(expectedResult, PathExtensions.GetAttributeValue(input, attribute));
|
||||||
|
Loading…
Reference in New Issue
Block a user