aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Boniface <joshua@boniface.me>2019-10-09 10:52:51 -0400
committerJoshua Boniface <joshua@boniface.me>2019-10-09 10:52:51 -0400
commit345a14ff5543256a4fa5c6a55f76d77334972c67 (patch)
tree73c122b59cfaaa9c48995427296012e8b8924542
parentb10e06ff459476042cff0eec5ebea3c304e6d1f5 (diff)
Use value instead of assigning baseUrl first
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs21
1 files changed, 8 insertions, 13 deletions
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index b0a96aa03..b8abe49e3 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -168,31 +168,26 @@ namespace MediaBrowser.Model.Configuration
get => _baseUrl;
set
{
- _baseUrl = value;
-
// Normalize the start of the string
- if (string.IsNullOrWhiteSpace(_baseUrl))
+ if (string.IsNullOrWhiteSpace(value))
{
// If baseUrl is empty, set an empty prefix string
- _baseUrl = string.Empty;
+ value = string.Empty;
}
- else if (!_baseUrl.StartsWith("/"))
+ else if (!value.StartsWith("/"))
{
// If baseUrl was not configured with a leading slash, append one for consistency
- _baseUrl = "/" + _baseUrl;
- }
- else
- {
- // If baseUrl was configured with a leading slash, just return it as-is
- _baseUrl = _baseUrl;
+ value = "/" + value;
}
// Normalize the end of the string
- if (_baseUrl.EndsWith("/"))
+ if (value.EndsWith("/"))
{
// If baseUrl was configured with a trailing slash, remove it for consistency
- _baseUrl = _baseUrl.Remove(_baseUrl.Length - 1);
+ value = value.Remove(value.Length - 1);
}
+
+ _baseUrl = value;
}
}