mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-17 12:42:16 +01:00
fix: replace depracted io/ioutil package with os package
This commit is contained in:
@@ -2,8 +2,8 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -426,7 +426,7 @@ func (form *FormData) mandatoryPath(filename string, target *string) *FormData {
|
|||||||
// readFile binds the content of a file to a string variable. It populates an
|
// readFile binds the content of a file to a string variable. It populates an
|
||||||
// error if it fails to read the file content.
|
// error if it fails to read the file content.
|
||||||
func (form *FormData) readFile(path, filename string, target *string) *FormData {
|
func (form *FormData) readFile(path, filename string, target *string) *FormData {
|
||||||
b, err := ioutil.ReadFile(path)
|
b, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
form.append(
|
form.append(
|
||||||
fmt.Errorf("form file '%s' is invalid (%w)", filename, err),
|
fmt.Errorf("form file '%s' is invalid (%w)", filename, err),
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -808,7 +807,7 @@ func (mod Chromium) PDF(ctx context.Context, logger *zap.Logger, URL, outputPath
|
|||||||
return fmt.Errorf("%v: %w", consoleExceptions, ErrConsoleExceptions)
|
return fmt.Errorf("%v: %w", consoleExceptions, ErrConsoleExceptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(outputPath, buffer, 0600)
|
err = os.WriteFile(outputPath, buffer, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("write result to output path: %w", err)
|
return fmt.Errorf("write result to output path: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -271,7 +270,7 @@ func convertMarkdownRoute(chromium API, engine gotenberg.PDFEngine) api.Route {
|
|||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := ioutil.ReadFile(path)
|
b, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("read markdown file '%s': %w", filename, err)
|
return "", fmt.Errorf("read markdown file '%s': %w", filename, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user