diff --git a/internal/dav/listing.go b/internal/dav/listing.go index 0b7bcf9..b9bb1ce 100644 --- a/internal/dav/listing.go +++ b/internal/dav/listing.go @@ -39,6 +39,10 @@ func HandlePropfindRequest(w http.ResponseWriter, r *http.Request, t *torrent.To } if err != nil { + if strings.Contains(err.Error(), "cannot find") { + http.Error(w, "Not Found", http.StatusNotFound) + return + } log.Errorf("Error processing request: %v", err) http.Error(w, "Server error", http.StatusInternalServerError) return diff --git a/internal/http/listing.go b/internal/http/listing.go index af7e399..ddf0db7 100644 --- a/internal/http/listing.go +++ b/internal/http/listing.go @@ -34,8 +34,11 @@ func HandleDirectoryListing(w http.ResponseWriter, r *http.Request, t *torrent.T http.Error(w, "Not Found", http.StatusNotFound) return } - if err != nil { + if strings.Contains(err.Error(), "cannot find") { + http.Error(w, "Not Found", http.StatusNotFound) + return + } log.Errorf("Error processing request: %v", err) http.Error(w, "Server error", http.StatusInternalServerError) return diff --git a/pkg/http/client.go b/pkg/http/client.go index 7885a5a..342fd91 100644 --- a/pkg/http/client.go +++ b/pkg/http/client.go @@ -59,7 +59,7 @@ func NewHTTPClient(token string, maxRetries int, c config.ConfigInterface) *HTTP // no need to retry return false }, - log: logutil.NewLogger().Named("http"), + log: logutil.NewLogger().Named("client"), config: c, } } diff --git a/pkg/realdebrid/api.go b/pkg/realdebrid/api.go index 6c8831d..5367d7f 100644 --- a/pkg/realdebrid/api.go +++ b/pkg/realdebrid/api.go @@ -177,7 +177,7 @@ func (rd *RealDebrid) SelectTorrentFiles(id string, files string) error { } defer resp.Body.Close() - rd.log.Debugf("Selected files %d for torrent id=%s", len(strings.Split(files, ",")), id) + rd.log.Debugf("Started the download for torrent id=%s", len(strings.Split(files, ",")), id) return nil }