Merge branch 'master' into test-keploy-cli
This commit is contained in:
commit
f9478f12cb
12 changed files with 19 additions and 24 deletions
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
@ -121,7 +121,7 @@ func handleBounceWebhook(c echo.Context) error {
|
|||
)
|
||||
|
||||
// Read the request body instead of using c.Bind() to read to save the entire raw request as meta.
|
||||
rawReq, err := ioutil.ReadAll(c.Request().Body)
|
||||
rawReq, err := io.ReadAll(c.Request().Body)
|
||||
if err != nil {
|
||||
app.log.Printf("error reading ses notification body: %v", err)
|
||||
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.Ts("globals.messages.internalError"))
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
|
@ -66,7 +66,7 @@ func handleImportSubscribers(c echo.Context) error {
|
|||
}
|
||||
defer src.Close()
|
||||
|
||||
out, err := ioutil.TempFile("", "listmonk")
|
||||
out, err := os.CreateTemp("", "listmonk")
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError,
|
||||
app.i18n.Ts("import.errorCopyingFile", "error", err.Error()))
|
||||
|
|
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
@ -224,7 +223,7 @@ func newConfigFile(path string) error {
|
|||
ReplaceAll(b, []byte(fmt.Sprintf(`admin_password = "%s"`, pwd)))
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(path, b, 0644)
|
||||
return os.WriteFile(path, b, 0644)
|
||||
}
|
||||
|
||||
// checkSchema checks if the DB schema is installed.
|
||||
|
|
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"runtime"
|
||||
|
@ -244,7 +244,7 @@ func handleTestSMTPSettings(c echo.Context) error {
|
|||
app := c.Get("app").(*App)
|
||||
|
||||
// Copy the raw JSON post body.
|
||||
reqBody, err := ioutil.ReadAll(c.Request().Body)
|
||||
reqBody, err := io.ReadAll(c.Request().Body)
|
||||
if err != nil {
|
||||
app.log.Printf("error reading SMTP test: %v", err)
|
||||
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.Ts("globals.messages.internalError"))
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"strings"
|
||||
|
@ -49,7 +49,7 @@ func handleSendTxMessage(c echo.Context) error {
|
|||
}
|
||||
defer file.Close()
|
||||
|
||||
b, err := ioutil.ReadAll(file)
|
||||
b, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError,
|
||||
app.i18n.Ts("globals.messages.invalidFields", "name", fmt.Sprintf("file: %s", err.Error())))
|
||||
|
|
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"time"
|
||||
|
@ -48,7 +48,7 @@ func checkUpdates(curVersion string, interval time.Duration, app *App) {
|
|||
continue
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
app.log.Printf("error reading remote update payload: %v", err)
|
||||
continue
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
|
@ -239,7 +239,7 @@ func (s *SES) getCert(certURL string) (*x509.Certificate, error) {
|
|||
return nil, fmt.Errorf("invalid SNS certificate URL: %v", u.Host)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package captcha
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
@ -58,7 +58,7 @@ func (c *Captcha) Verify(token string) (error, bool) {
|
|||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err, false
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"crypto/rand"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
@ -67,7 +66,7 @@ func (c *Client) GetURL(name string) string {
|
|||
|
||||
// GetBlob accepts a URL, reads the file, and returns the blob.
|
||||
func (c *Client) GetBlob(url string) ([]byte, error) {
|
||||
b, err := ioutil.ReadFile(filepath.Join(getDir(c.opts.UploadPath), filepath.Base(url)))
|
||||
b, err := os.ReadFile(filepath.Join(getDir(c.opts.UploadPath), filepath.Base(url)))
|
||||
return b, err
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package s3
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -123,7 +122,7 @@ func (c *Client) GetBlob(uurl string) ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadAll(file)
|
||||
b, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"time"
|
||||
|
@ -197,7 +196,7 @@ func (p *Postback) exec(method, rURL string, reqBody []byte, headers http.Header
|
|||
}
|
||||
defer func() {
|
||||
// Drain and close the body to let the Transport reuse the connection
|
||||
io.Copy(ioutil.Discard, r.Body)
|
||||
io.Copy(io.Discard, r.Body)
|
||||
r.Body.Close()
|
||||
}()
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/mail"
|
||||
"os"
|
||||
|
@ -377,7 +376,7 @@ func (s *Session) ExtractZIP(srcPath string, maxCSVs int) (string, []string, err
|
|||
defer z.Close()
|
||||
|
||||
// Create a temporary directory to extract the files.
|
||||
dir, err := ioutil.TempDir("", "listmonk")
|
||||
dir, err := os.MkdirTemp("", "listmonk")
|
||||
if err != nil {
|
||||
s.log.Printf("error creating temporary directory for extracting ZIP: %v", err)
|
||||
return "", nil, err
|
||||
|
|
Loading…
Reference in a new issue