Skip to content

Commit

Permalink
Fixed #3455
Browse files Browse the repository at this point in the history
  • Loading branch information
tidusjar committed Mar 31, 2020
1 parent 10430cf commit b09d4e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/Ombi.Helpers.Tests/EmbyHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ public static IEnumerable<TestCaseData> UrlData
get
{
var mediaId = 1;
yield return new TestCaseData(mediaId.ToString(), "http://google.com").Returns($"http://google.com/#!/item/item.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
yield return new TestCaseData(mediaId.ToString(), "http://google.com/").Returns($"http://google.com/#!/item/item.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain");
yield return new TestCaseData(mediaId.ToString(), "https://google.com/").Returns($"https://google.com/#!/item/item.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_Https");
yield return new TestCaseData(mediaId.ToString(), "http://google.com").Returns($"http://google.com/#!/item?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
yield return new TestCaseData(mediaId.ToString(), "http://google.com/").Returns($"http://google.com/#!/item?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain");
yield return new TestCaseData(mediaId.ToString(), "https://google.com/").Returns($"https://google.com/#!/item?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_Https");
yield return new TestCaseData(mediaId.ToString(), string.Empty).Returns($"https://app.emby.media/#!/item?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithOutCustomDomain");
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/Ombi.Helpers/EmbyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ public class EmbyHelper
{
public static string GetEmbyMediaUrl(string mediaId, string customerServerUrl = null, bool isJellyfin = false)
{
string path = "item/item";
string path = "item";
if (isJellyfin)
{
path = "itemdetails";
path = "itemdetails.html";
}
if (customerServerUrl.HasValue())
{
if (!customerServerUrl.EndsWith("/"))
{
return $"{customerServerUrl}/#!/{path}.html?id={mediaId}";
return $"{customerServerUrl}/#!/{path}?id={mediaId}";
}
return $"{customerServerUrl}#!/{path}.html?id={mediaId}";
return $"{customerServerUrl}#!/{path}?id={mediaId}";
}
else
{
return $"https://app.emby.media/#!/{path}.html?id={mediaId}";
return $"https://app.emby.media/#!/{path}?id={mediaId}";
}
}
}
Expand Down

0 comments on commit b09d4e4

Please sign in to comment.