Fix Uri scheme

This commit is contained in:
Zoe Roux 2022-06-12 23:44:01 +02:00
parent 54caa2956d
commit b6daaf6aaa
No known key found for this signature in database
GPG Key ID: 54F19BB73170955D
3 changed files with 10 additions and 11 deletions

View File

@ -33,17 +33,17 @@ namespace Kyoo.Abstractions.Models
/// <summary> /// <summary>
/// The link of the current page. /// The link of the current page.
/// </summary> /// </summary>
public Uri This { get; } public string This { get; }
/// <summary> /// <summary>
/// The link of the first page. /// The link of the first page.
/// </summary> /// </summary>
public Uri First { get; } public string First { get; }
/// <summary> /// <summary>
/// The link of the next page. /// The link of the next page.
/// </summary> /// </summary>
public Uri Next { get; } public string Next { get; }
/// <summary> /// <summary>
/// The number of items in the current page. /// The number of items in the current page.
@ -62,7 +62,7 @@ namespace Kyoo.Abstractions.Models
/// <param name="this">The link of the current page.</param> /// <param name="this">The link of the current page.</param>
/// <param name="next">The link of the next page.</param> /// <param name="next">The link of the next page.</param>
/// <param name="first">The link of the first page.</param> /// <param name="first">The link of the first page.</param>
public Page(ICollection<T> items, Uri @this, Uri next, Uri first) public Page(ICollection<T> items, string @this, string next, string first)
{ {
Items = items; Items = items;
This = @this; This = @this;
@ -78,21 +78,21 @@ namespace Kyoo.Abstractions.Models
/// <param name="query">The list of query strings of the current page</param> /// <param name="query">The list of query strings of the current page</param>
/// <param name="limit">The number of items requested for the current page.</param> /// <param name="limit">The number of items requested for the current page.</param>
public Page(ICollection<T> items, public Page(ICollection<T> items,
Uri url, string url,
Dictionary<string, string> query, Dictionary<string, string> query,
int limit) int limit)
{ {
Items = items; Items = items;
This = new Uri(url + query.ToQueryString()); This = url + query.ToQueryString();
if (items.Count == limit && limit > 0) if (items.Count == limit && limit > 0)
{ {
query["afterID"] = items.Last().ID.ToString(); query["afterID"] = items.Last().ID.ToString();
Next = new Uri(url + query.ToQueryString()); Next = url + query.ToQueryString();
} }
query.Remove("afterID"); query.Remove("afterID");
First = new Uri(url + query.ToQueryString()); First = url + query.ToQueryString();
} }
} }
} }

View File

@ -44,7 +44,7 @@ namespace Kyoo.Core.Api
{ {
return new Page<TResult>( return new Page<TResult>(
resources, resources,
new Uri(Request.Path), Request.Path,
Request.Query.ToDictionary( Request.Query.ToDictionary(
x => x.Key, x => x.Key,
x => x.Value.ToString(), x => x.Value.ToString(),

View File

@ -144,8 +144,7 @@ namespace Kyoo.Core.Api
string type = target is ICustomTypeDescriptor descriptor string type = target is ICustomTypeDescriptor descriptor
? descriptor.GetClassName() ? descriptor.GetClassName()
: target.GetType().Name; : target.GetType().Name;
return new Uri($"/{type}/{slug}/{Images.ImageName[_imageIndex]}".ToLowerInvariant()) return $"/{type}/{slug}/{Images.ImageName[_imageIndex]}".ToLowerInvariant();
.ToString();
} }
} }
} }