Skip to content

Commit

Permalink
Metadata file not being found should throw an error
Browse files Browse the repository at this point in the history
  • Loading branch information
mstg committed May 10, 2022
1 parent 16ad80f commit 6ab7f9f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/srpmproc/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"strings"
)
Expand All @@ -33,6 +32,9 @@ func Fetch(logger io.Writer, cdnUrl string, dir string, fs billy.Filesystem, sto
metadataPath = filepath.Join(dir, f.Name())
}
}
if metadataPath == "" {
return errors.New("no metadata file found")
}

metadataFile, err := fs.Open(metadataPath)
if err != nil {
Expand Down Expand Up @@ -99,9 +101,9 @@ func Fetch(logger io.Writer, cdnUrl string, dir string, fs billy.Filesystem, sto
return fmt.Errorf("checksum in metadata does not match dist-git file")
}

err = os.MkdirAll(filepath.Join(dir, filepath.Dir(path)), 0755)
err = fs.MkdirAll(filepath.Join(dir, filepath.Dir(path)), 0755)
if err != nil {
return fmt.Errorf("could create all directories")
return fmt.Errorf("could not create all directories")
}

f, err := fs.Create(filepath.Join(dir, path))
Expand Down

0 comments on commit 6ab7f9f

Please sign in to comment.