fixes here and there

This commit is contained in:
Ben Sarmiento
2023-11-11 02:34:46 +01:00
parent 147c0bd444
commit cd96c7bd38
14 changed files with 181 additions and 155 deletions

View File

@@ -33,7 +33,7 @@ func HandlePropfindRequest(w http.ResponseWriter, r *http.Request, t *torrent.To
case len(filteredSegments) == 2:
output, err = handleSingleTorrent(requestPath, w, r, t)
default:
log.Errorf("Request %s %s not found", r.Method, requestPath)
log.Warnf("Request %s %s not found", r.Method, requestPath)
http.Error(w, "Not Found", http.StatusNotFound)
return
}
@@ -54,9 +54,9 @@ func HandlePropfindRequest(w http.ResponseWriter, r *http.Request, t *torrent.To
func handleRoot(w http.ResponseWriter, r *http.Request, c config.ConfigInterface) ([]byte, error) {
var responses []dav.Response
responses = append(responses, dav.Directory("/"))
responses = append(responses, dav.Directory(""))
for _, directory := range c.GetDirectories() {
responses = append(responses, dav.Directory("/"+directory))
responses = append(responses, dav.Directory(directory))
}
rootResponse := dav.MultiStatus{
XMLNS: "DAV:",
@@ -104,7 +104,7 @@ func handleSingleTorrent(requestPath string, w http.ResponseWriter, r *http.Requ
accessKey := path.Base(requestPath)
torrent, exists := t.TorrentMap.Get(accessKey)
if !exists {
return nil, fmt.Errorf("cannot find torrent %s", requestPath)
return nil, fmt.Errorf("cannot find torrent %s", accessKey)
}
var responses []dav.Response