mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
sign: use filepath.Join instead of fmt.Sprintf
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ func signCmd(c *cli.Context) error {
|
|||||||
return errors.Wrapf(err, "error creating new signature")
|
return errors.Wrapf(err, "error creating new signature")
|
||||||
}
|
}
|
||||||
|
|
||||||
sigStoreDir = fmt.Sprintf("%s/%s", sigStoreDir, strings.Replace(repos[0][strings.Index(repos[0], "/")+1:len(repos[0])], ":", "=", 1))
|
sigStoreDir = filepath.Join(sigStoreDir, strings.Replace(repos[0][strings.Index(repos[0], "/")+1:len(repos[0])], ":", "=", 1))
|
||||||
if err := os.MkdirAll(sigStoreDir, 0751); err != nil {
|
if err := os.MkdirAll(sigStoreDir, 0751); err != nil {
|
||||||
// The directory is allowed to exist
|
// The directory is allowed to exist
|
||||||
if !os.IsExist(err) {
|
if !os.IsExist(err) {
|
||||||
@ -154,7 +154,7 @@ func signCmd(c *cli.Context) error {
|
|||||||
logrus.Errorf("error creating sigstore file: %v", err)
|
logrus.Errorf("error creating sigstore file: %v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
err = ioutil.WriteFile(sigStoreDir+"/"+sigFilename, newSig, 0644)
|
err = ioutil.WriteFile(filepath.Join(sigStoreDir, sigFilename), newSig, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("error storing signature for %s", rawSource.Reference().DockerReference().String())
|
logrus.Errorf("error storing signature for %s", rawSource.Reference().DockerReference().String())
|
||||||
continue
|
continue
|
||||||
|
Reference in New Issue
Block a user