fix: clean file path.
This commit is contained in:
parent
6a71a1655e
commit
5005a38227
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/abronan/valkeyrie/store"
|
"github.com/abronan/valkeyrie/store"
|
||||||
@ -125,7 +126,7 @@ func getCAContent(ca string) ([]byte, error) {
|
|||||||
return []byte(ca), nil
|
return []byte(ca), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
caContent, err := ioutil.ReadFile(ca)
|
caContent, err := ioutil.ReadFile(filepath.Clean(ca))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containous/traefik/v2/pkg/provider/acme"
|
"github.com/containous/traefik/v2/pkg/provider/acme"
|
||||||
@ -71,7 +72,7 @@ func dumpV2(acmeFile string, baseConfig *dumper.BaseConfig) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readJSONFile(acmeFile string, data interface{}) error {
|
func readJSONFile(acmeFile string, data interface{}) error {
|
||||||
source, err := os.Open(acmeFile)
|
source, err := os.Open(filepath.Clean(acmeFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open file %q: %w", acmeFile, err)
|
return fmt.Errorf("failed to open file %q: %w", acmeFile, err)
|
||||||
}
|
}
|
||||||
@ -186,7 +187,7 @@ func manageRename(watcher *fsnotify.Watcher, event fsnotify.Event, acmeFile stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func calculateHash(acmeFile string) ([]byte, error) {
|
func calculateHash(acmeFile string) ([]byte, error) {
|
||||||
file, err := os.Open(acmeFile)
|
file, err := os.Open(filepath.Clean(acmeFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import (
|
|||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/abronan/valkeyrie"
|
"github.com/abronan/valkeyrie"
|
||||||
@ -91,7 +92,7 @@ func putData(backend store.Backend, addrs []string, content []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readFile(source string) ([]byte, error) {
|
func readFile(source string) ([]byte, error) {
|
||||||
content, err := ioutil.ReadFile(source)
|
content, err := ioutil.ReadFile(filepath.Clean(source))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user