pull/3632/head
tidusjar 5 years ago
parent b8632b2185
commit abf4a424b3

@ -70,7 +70,7 @@ namespace Ombi.Core.Tests.Rule.Search
var result = await Rule.Execute(search);
Assert.True(result.Success);
Assert.That(search.EmbyUrl, Is.EqualTo("http://test.com/#!/item.html?id=1"));
Assert.That(search.EmbyUrl, Is.EqualTo("http://test.com/#!/item?id=1"));
}
[Test]
@ -99,7 +99,7 @@ namespace Ombi.Core.Tests.Rule.Search
var result = await Rule.Execute(search);
Assert.True(result.Success);
Assert.That(search.EmbyUrl, Is.EqualTo("https://app.emby.media/#!/item.html?id=1"));
Assert.That(search.EmbyUrl, Is.EqualTo("https://app.emby.media/#!/item?id=1"));
}
[Test]

@ -15,9 +15,9 @@ namespace Tests
{
ApplicationUrl = applicationUrl
};
c.AddToUrl(append);
var result = c.AddToUrl(append);
return c.ApplicationUrl;
return result;
}
public static IEnumerable<TestCaseData> TestData
@ -25,6 +25,8 @@ namespace Tests
get
{
yield return new TestCaseData("https://google.com/", "token?").Returns("https://google.com/token?").SetName("ForwardSlash_On_AppUrl_NotOn_Append");
yield return new TestCaseData("https://google.com", "token?").Returns("https://google.com/token?").SetName("NoForwardSlash_On_AppUrl_NotOn_Append");
yield return new TestCaseData(null, "token?").Returns(null).SetName("NullValue");
}
}
}

@ -12,22 +12,24 @@
public bool RecentlyAddedPage { get; set; }
public bool UseCustomPage { get; set; }
public void AddToUrl(string part)
public string AddToUrl(string part)
{
if (string.IsNullOrEmpty(ApplicationUrl))
var appUrl = ApplicationUrl;
if (string.IsNullOrEmpty(appUrl))
{
ApplicationUrl = part;
return null;
}
if (ApplicationUrl.EndsWith("/"))
if (appUrl.EndsWith("/"))
{
ApplicationUrl = ApplicationUrl.Remove(ApplicationUrl.Length - 1);
appUrl = appUrl.Remove(ApplicationUrl.Length - 1);
}
if (!part.StartsWith("/"))
{
part = "/" + part;
}
ApplicationUrl = ApplicationUrl + part;
appUrl = appUrl + part;
return appUrl;
}
}
}

@ -13,7 +13,6 @@ import { IdentityService, ImageService, NotificationService, SettingsService } f
export class ResetPasswordComponent implements OnInit {
public form: FormGroup;
public customizationSettings: ICustomizationSettings;
public emailSettingsEnabled: boolean;
public baseUrl: string;
public background: any;
@ -36,7 +35,6 @@ export class ResetPasswordComponent implements OnInit {
if (base.length > 1) {
this.baseUrl = base;
}
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
this.settingsService.getEmailSettingsEnabled().subscribe(x => this.emailSettingsEnabled = x);
}

@ -793,8 +793,10 @@ namespace Ombi.Controllers.V1
var emailSettings = await EmailSettings.GetSettingsAsync();
customizationSettings.AddToUrl("/token?token=");
var url = customizationSettings.ApplicationUrl;
var appUrl = customizationSettings.AddToUrl("/token?token=");
var url = (string.IsNullOrEmpty(appUrl)
? $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/token?token="
: appUrl);
if (user.UserType == UserType.PlexUser)
{

Loading…
Cancel
Save