diff options
| author | Vasily <JustAMan@users.noreply.github.com> | 2019-02-04 14:10:08 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-04 14:10:08 +0300 |
| commit | 83af2db679bb3b06243b122825653bdb86f2fc27 (patch) | |
| tree | de34e7ebdfd25c83190e5903d8b444b6e2b00765 /MediaBrowser.Api/BaseApiService.cs | |
| parent | 0b3e6548dbea5db4d31e3947cc2406852d8e3733 (diff) | |
| parent | cb7bffc233bcdb1dfb2b6be629dc8f13e482cd3b (diff) | |
Merge pull request #798 from Bond-009/apientrypoint
Cleanup around the api endpoints
Diffstat (limited to 'MediaBrowser.Api/BaseApiService.cs')
| -rw-r--r-- | MediaBrowser.Api/BaseApiService.cs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 4a484b718..451ee72dd 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Api public static string[] SplitValue(string value, char delim) { - if (string.IsNullOrWhiteSpace(value)) + if (value == null) { return Array.Empty<string>(); } @@ -53,8 +53,14 @@ namespace MediaBrowser.Api public static Guid[] GetGuids(string value) { - // Unfortunately filtermenu.js was using |. This can be deprecated after a while. - return (value ?? string.Empty).Split(new[] { ',', '|' }, StringSplitOptions.RemoveEmptyEntries).Select(i => new Guid(i)).ToArray(); + if (value == null) + { + return Array.Empty<Guid>(); + } + + return value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) + .Select(i => new Guid(i)) + .ToArray(); } /// <summary> @@ -118,7 +124,8 @@ namespace MediaBrowser.Api options.Fields = hasFields.GetItemFields(); } - if (!options.ContainsField(Model.Querying.ItemFields.RecursiveItemCount) || !options.ContainsField(Model.Querying.ItemFields.ChildCount)) + if (!options.ContainsField(Model.Querying.ItemFields.RecursiveItemCount) + || !options.ContainsField(Model.Querying.ItemFields.ChildCount)) { var client = authContext.GetAuthorizationInfo(Request).Client ?? string.Empty; if (client.IndexOf("kodi", StringComparison.OrdinalIgnoreCase) != -1 || @@ -145,8 +152,7 @@ namespace MediaBrowser.Api } } - var hasDtoOptions = request as IHasDtoOptions; - if (hasDtoOptions != null) + if (request is IHasDtoOptions hasDtoOptions) { options.EnableImages = hasDtoOptions.EnableImages ?? true; @@ -294,7 +300,7 @@ namespace MediaBrowser.Api return pathInfo[index]; } - private List<string> Parse(string pathUri) + private string[] Parse(string pathUri) { var actionParts = pathUri.Split(new[] { "://" }, StringSplitOptions.None); @@ -308,7 +314,7 @@ namespace MediaBrowser.Api var args = pathInfo.Split('/'); - return args.Skip(1).ToList(); + return args.Skip(1).ToArray(); } /// <summary> |
