Minor bug fixes
This commit is contained in:
+10
-10
@@ -115,9 +115,9 @@ func (c *Config) loadConfig() error {
|
||||
c.Auth = c.GetAuth()
|
||||
|
||||
//Validate the config
|
||||
//if err := validateConfig(c); err != nil {
|
||||
// return err
|
||||
//}
|
||||
if err := validateConfig(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -143,13 +143,13 @@ func validateDebrids(debrids []Debrid) error {
|
||||
}
|
||||
|
||||
// Check folder existence concurrently
|
||||
wg.Add(1)
|
||||
go func(folder string) {
|
||||
defer wg.Done()
|
||||
if _, err := os.Stat(folder); os.IsNotExist(err) {
|
||||
errChan <- fmt.Errorf("debrid folder does not exist: %s", folder)
|
||||
}
|
||||
}(debrid.Folder)
|
||||
//wg.Add(1)
|
||||
//go func(folder string) {
|
||||
// defer wg.Done()
|
||||
// if _, err := os.Stat(folder); os.IsNotExist(err) {
|
||||
// errChan <- fmt.Errorf("debrid folder does not exist: %s", folder)
|
||||
// }
|
||||
//}(debrid.Folder)
|
||||
}
|
||||
|
||||
// Wait for all checks to complete
|
||||
|
||||
@@ -3,6 +3,7 @@ package request
|
||||
import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"golang.org/x/time/rate"
|
||||
"io"
|
||||
@@ -109,7 +110,7 @@ func (c *RLHTTPClient) MakeRequest(req *http.Request) ([]byte, error) {
|
||||
if !statusOk {
|
||||
// Add status code error to the body
|
||||
b = append(b, []byte(fmt.Sprintf("\nstatus code: %d", res.StatusCode))...)
|
||||
return nil, fmt.Errorf(string(b))
|
||||
return nil, errors.New(string(b))
|
||||
}
|
||||
|
||||
return b, nil
|
||||
@@ -160,5 +161,8 @@ func ParseRateLimit(rateStr string) *rate.Limiter {
|
||||
func JSONResponse(w http.ResponseWriter, data interface{}, code int) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(code)
|
||||
json.NewEncoder(w).Encode(data)
|
||||
err := json.NewEncoder(w).Encode(data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user