Fix webtorrent not found share

This commit is contained in:
Alexey Khit
2023-03-20 06:15:55 +03:00
parent e1e8abc334
commit acf5ec5256
+8 -4
View File
@@ -99,11 +99,15 @@ func apiHandle(w http.ResponseWriter, r *http.Request) {
return
}
if ok {
if src != "" {
// response one share
pwd := srv.GetSharePwd(share)
data := fmt.Sprintf(`{"share":%q,"pwd":%q}`, share, pwd)
_, _ = w.Write([]byte(data))
if ok {
pwd := srv.GetSharePwd(share)
data := fmt.Sprintf(`{"share":%q,"pwd":%q}`, share, pwd)
_, _ = w.Write([]byte(data))
} else {
http.Error(w, "", http.StatusNotFound)
}
} else {
// response all shares
var items []api.Stream