start using "errors"

This commit is contained in:
6543 2022-06-02 15:41:47 +02:00
parent d35e41fa9f
commit d9127d1ed9
2 changed files with 23 additions and 5 deletions

View file

@ -2,6 +2,7 @@ package upstream
import (
"bytes"
"errors"
"fmt"
"io"
"strings"
@ -79,7 +80,7 @@ func (o *Options) Upstream(ctx *fasthttp.RequestCtx, giteaClient *gitea.Client,
log.Debug().Msg("acquisition")
// Handle errors
if (res == nil && !cachedResponse.Exists) || (res != nil && res.StatusCode() == fasthttp.StatusNotFound) {
if (err != nil && errors.Is(err, gitea.ErrorNotFound)) || (res == nil && !cachedResponse.Exists) {
if o.TryIndexPages {
// copy the o struct & try if an index page exists
optionsForIndexPages := *o