fix checksum issue

This commit is contained in:
Ben Sarmiento
2023-10-20 04:37:43 +02:00
parent f1717a8d94
commit 7010803e35
4 changed files with 13 additions and 12 deletions

View File

@@ -50,7 +50,7 @@ func Setup(app *aero.Application, c config.ConfigInterface, t *torrent.TorrentMa
torrentsInDirectory := t.GetByDirectory(directory)
resp, err := createMultiTorrentResponse(fmt.Sprintf("/%s", directory), torrentsInDirectory)
if err != nil {
log.Printf("Cannot read directory (%s): %v\n", directory, err.Error())
log.Printf("Cannot read directory (%s): %v\n", directory, err)
return ctx.Error(http.StatusInternalServerError, "Cannot read directory")
}
return xmlResponse(ctx, *resp)
@@ -62,7 +62,7 @@ func Setup(app *aero.Application, c config.ConfigInterface, t *torrent.TorrentMa
sameNameTorrents := findAllTorrentsWithName(t, directory, torrentName)
resp, err := createSingleTorrentResponse(fmt.Sprintf("/%s", directory), sameNameTorrents, t)
if err != nil {
log.Printf("Cannot read directory (%s): %v\n", directory, err.Error())
log.Printf("Cannot read directory (%s): %v\n", directory, err)
return ctx.Error(http.StatusInternalServerError, "Cannot read directory")
}
return xmlResponse(ctx, *resp)
@@ -119,7 +119,7 @@ func Setup(app *aero.Application, c config.ConfigInterface, t *torrent.TorrentMa
func xmlResponse(ctx aero.Context, resp dav.MultiStatus) error {
output, err := xml.MarshalIndent(resp, "", " ")
if err != nil {
log.Printf("Cannot marshal xml: %v\n", err.Error())
log.Printf("Cannot marshal xml: %v\n", err)
return ctx.Error(http.StatusInternalServerError, "Cannot read directory")
}

View File

@@ -42,7 +42,7 @@ func HandlePropfindRequest(w http.ResponseWriter, r *http.Request, t *torrent.To
return
}
if err != nil {
log.Printf("Cannot marshal xml: %v\n", err.Error())
log.Printf("Cannot marshal xml: %v\n", err)
http.Error(w, "Cannot read directory", http.StatusInternalServerError)
return
}
@@ -87,7 +87,7 @@ func handleListOfTorrents(requestPath string, w http.ResponseWriter, r *http.Req
torrents := t.GetByDirectory(basePath)
resp, err := createMultiTorrentResponse(fmt.Sprintf("/%s", basePath), torrents)
if err != nil {
log.Printf("Cannot read directory (%s): %v\n", basePath, err.Error())
log.Printf("Cannot read directory (%s): %v\n", basePath, err)
http.Error(w, "Cannot read directory", http.StatusInternalServerError)
return nil, nil
}
@@ -108,7 +108,7 @@ func handleSingleTorrent(requestPath string, w http.ResponseWriter, r *http.Requ
var resp *dav.MultiStatus
resp, err := createSingleTorrentResponse(fmt.Sprintf("/%s", directory), sameNameTorrents, t)
if err != nil {
log.Printf("Cannot read directory (%s): %v\n", requestPath, err.Error())
log.Printf("Cannot read directory (%s): %v\n", requestPath, err)
http.Error(w, "Cannot read directory", http.StatusInternalServerError)
return nil, nil
}