Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Decimation committed Apr 10, 2024
1 parent 3e85dad commit 809c64c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions SmartImage.Lib 3/Engines/Impl/Search/EHentaiEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ private Task<IFlurlResponse> GetSessionAsync(bool useEx = false)
{
return (useEx ? ExHentaiBase : EHentaiBase)
.WithCookies(m_cookies)
.WithTimeout(Timeout)
.WithHeaders(new
{
User_Agent = HttpUtilities.UserAgent
Expand Down
7 changes: 6 additions & 1 deletion SmartImage.Lib 3/Engines/Impl/Search/FluffleEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ public override async Task<SearchResult> GetResultAsync(SearchQuery query, Cance
})
.WithTimeout(Timeout)
.AllowAnyHttpStatus()
.OnError(e =>
{
e.ExceptionHandled = true;
})
.PostMultipartAsync(c =>
{
// var tmp = query.WriteToFile();
query.Uni.Stream.TrySeek();

c.AddFile("file", query.Uni.Stream, "file");
query.Uni.Stream.TrySeek();
Expand All @@ -63,7 +68,7 @@ public override async Task<SearchResult> GetResultAsync(SearchQuery query, Cance
// c.AddString("createLink", false)
}, cancellationToken: token);

if (!response.ResponseMessage.IsSuccessStatusCode) {
if (response is { ResponseMessage: { IsSuccessStatusCode: false } }) {
var er = await response.GetJsonAsync<FluffleErrorCode>();
sr.ErrorMessage = $"{er.Message}: {er.Code}";
return sr;
Expand Down

0 comments on commit 809c64c

Please sign in to comment.