Reenabled deletion of Time-Entrys
This commit is contained in:
@@ -73,10 +73,17 @@ internal sealed class ApiClient : IApiClient {
|
||||
using var res = await _http.SendAsync(req, HttpCompletionOption.ResponseHeadersRead, ct).ConfigureAwait(false);
|
||||
var text = await res.Content.ReadAsStringAsync(ct).ConfigureAwait(false);
|
||||
|
||||
if (res.StatusCode == System.Net.HttpStatusCode.NotFound) {
|
||||
var message = req.Method + ": " + req.RequestUri + " nicht gefunden";
|
||||
throw ApiException.From(res.StatusCode, message);
|
||||
}
|
||||
|
||||
if (!res.IsSuccessStatusCode)
|
||||
throw ApiException.From(res.StatusCode, TryGetMessage(text), text);
|
||||
|
||||
|
||||
if (res.StatusCode != System.Net.HttpStatusCode.OK) {
|
||||
|
||||
// Verhalten wie in BaseFunc: bei Fehlerstatus -> "message" aus Body lesen und mit dessen Inhalt eine Exception werfen.
|
||||
try {
|
||||
var options = new JsonDocumentOptions { AllowTrailingCommas = true };
|
||||
@@ -142,8 +149,27 @@ internal sealed class ApiClient : IApiClient {
|
||||
}
|
||||
|
||||
// Wenn path bereits absolut ist, direkt verwenden
|
||||
if (Uri.TryCreate(relativePath, UriKind.Absolute, out var absoluteFromPath))
|
||||
return absoluteFromPath;
|
||||
//if (Uri.TryCreate(relativePath, UriKind.Absolute, out var absoluteFromPath))
|
||||
// return absoluteFromPath;
|
||||
|
||||
// Sonderfall: Wenn path ein absoluter file:// URI ist, diesen relativ zur Basis behandeln
|
||||
// Weiß nicht wie file:// zustande kommt, vermutlich wäre das zu verhindern
|
||||
if (Uri.TryCreate(relativePath, UriKind.Absolute, out var uri)) {
|
||||
if (uri.Scheme == Uri.UriSchemeFile) {
|
||||
|
||||
var normalizedBase = baseUrl.Trim();
|
||||
if (!normalizedBase.EndsWith('/'))
|
||||
normalizedBase += "/";
|
||||
|
||||
if (relativePath.StartsWith('/'))
|
||||
relativePath = relativePath.TrimStart('/');
|
||||
|
||||
var baseUriNormalized = new Uri(normalizedBase, UriKind.Absolute);
|
||||
return new Uri(baseUriNormalized, relativePath);
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
return new Uri(baseUri, relativePath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user