aboutsummaryrefslogtreecommitdiff
path: root/Emby.Dlna
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2020-09-27 20:01:32 +0200
committerGitHub <noreply@github.com>2020-09-27 20:01:32 +0200
commit43add833cc3c283a1cb2e0df98faeccde9671063 (patch)
tree6909c9c522e1d85fd8a04b8eee2f45deab6c9e3e /Emby.Dlna
parent63b49ff4d84a6c18d7db188435eeb9e429e6bfd0 (diff)
parentd99db543daf770a059830627dbdc255ae6abe42e (diff)
Merge pull request #4162 from BaronGreenback/DlnaServerBaseUrlFix
Fix for #4161: BaseUrl in DLNA
Diffstat (limited to 'Emby.Dlna')
-rw-r--r--Emby.Dlna/Server/DescriptionXmlBuilder.cs16
1 files changed, 11 insertions, 5 deletions
diff --git a/Emby.Dlna/Server/DescriptionXmlBuilder.cs b/Emby.Dlna/Server/DescriptionXmlBuilder.cs
index bca9e81cd..1f429d0de 100644
--- a/Emby.Dlna/Server/DescriptionXmlBuilder.cs
+++ b/Emby.Dlna/Server/DescriptionXmlBuilder.cs
@@ -235,13 +235,13 @@ namespace Emby.Dlna.Server
.Append(SecurityElement.Escape(service.ServiceId ?? string.Empty))
.Append("</serviceId>");
builder.Append("<SCPDURL>")
- .Append(BuildUrl(service.ScpdUrl))
+ .Append(BuildUrl(service.ScpdUrl, true))
.Append("</SCPDURL>");
builder.Append("<controlURL>")
- .Append(BuildUrl(service.ControlUrl))
+ .Append(BuildUrl(service.ControlUrl, true))
.Append("</controlURL>");
builder.Append("<eventSubURL>")
- .Append(BuildUrl(service.EventSubUrl))
+ .Append(BuildUrl(service.EventSubUrl, true))
.Append("</eventSubURL>");
builder.Append("</service>");
@@ -250,7 +250,13 @@ namespace Emby.Dlna.Server
builder.Append("</serviceList>");
}
- private string BuildUrl(string url)
+ /// <summary>
+ /// Builds a valid url for inclusion in the xml.
+ /// </summary>
+ /// <param name="url">Url to include.</param>
+ /// <param name="absoluteUrl">Optional. When set to true, the absolute url is always used.</param>
+ /// <returns>The url to use for the element.</returns>
+ private string BuildUrl(string url, bool absoluteUrl = false)
{
if (string.IsNullOrEmpty(url))
{
@@ -261,7 +267,7 @@ namespace Emby.Dlna.Server
url = "/dlna/" + _serverUdn + "/" + url;
- if (EnableAbsoluteUrls)
+ if (EnableAbsoluteUrls || absoluteUrl)
{
url = _serverAddress.TrimEnd('/') + url;
}