Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only force scheme and port when HTTPS is disallowed #6871

Merged
merged 1 commit into from
Nov 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Emby.Server.Implementations/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,12 @@ public string GetSmartApiUrl(string hostname)
}

/// <inheritdoc/>
public string GetApiUrlForLocalAccess(bool allowHttps)
public string GetApiUrlForLocalAccess(bool allowHttps = true)
{
// With an empty source, the port will be null
string smart = NetManager.GetBindInterface(string.Empty, out _);
var scheme = allowHttps ? Uri.UriSchemeHttps : Uri.UriSchemeHttp;
var port = allowHttps ? HttpsPort : HttpPort;
var scheme = !allowHttps ? Uri.UriSchemeHttp : null;
int? port = !allowHttps ? HttpPort : null;
Comment on lines +1135 to +1136
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, the negation should be removed

return GetLocalApiUrl(smart.Trim('/'), scheme, port);
}

Expand Down