mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-13 19:02:15 +01:00
WIP: refactoring logging system
This commit is contained in:
@@ -7,9 +7,9 @@ import (
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/labstack/gommon/random"
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
"github.com/russross/blackfriday/v2"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/rand"
|
||||
)
|
||||
|
||||
// NewMarkdown returns a Markdown printer.
|
||||
@@ -27,10 +27,7 @@ func NewMarkdown(fpath string, opts *ChromeOptions) (Printer, error) {
|
||||
if err := tmpl.Execute(&buffer, data); err != nil {
|
||||
return nil, fmt.Errorf("%s: executing template: %v", fpath, err)
|
||||
}
|
||||
baseFilename, err := rand.Get()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
baseFilename := random.String(32)
|
||||
dst := fmt.Sprintf("%s/%s.html", dirPath, baseFilename)
|
||||
if err := ioutil.WriteFile(dst, buffer.Bytes(), 0644); err != nil {
|
||||
return nil, fmt.Errorf("%s: writing file: %v", dst, err)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/rand"
|
||||
"github.com/labstack/gommon/random"
|
||||
)
|
||||
|
||||
type office struct {
|
||||
@@ -38,10 +38,7 @@ func (p *office) Print(destination string) error {
|
||||
fpaths := make([]string, len(p.fpaths))
|
||||
dirPath := filepath.Dir(destination)
|
||||
for i, fpath := range p.fpaths {
|
||||
baseFilename, err := rand.Get()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
baseFilename := random.String(32)
|
||||
tmpDest := fmt.Sprintf("%s/%d%s.pdf", dirPath, i, baseFilename)
|
||||
if err := unoconv(ctx, fpath, tmpDest, p.opts); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user