Skip to content

Commit

Permalink
fix: fix crash when package file doesn't exist during prune
Browse files Browse the repository at this point in the history
  • Loading branch information
lleyton authored Apr 23, 2023
1 parent 048dc6e commit c0fab82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func (router *reposRouter) uploadToRepo(w http.ResponseWriter, r *http.Request)

if len(toPrune) > 0 {
for _, p := range toPrune {
if err := os.Remove(path.Join(targetDirectory, p.FilePath)); err != nil {
if err := os.Remove(path.Join(targetDirectory, p.FilePath)); err != nil && !os.IsNotExist(err) {
panic(err)
}
}
Expand Down Expand Up @@ -550,7 +550,7 @@ func (router *reposRouter) deleteRPM(w http.ResponseWriter, r *http.Request) {

targetDirectory := path.Join(router.enviroment.StorageDirectory, id, rpm.FilePath)

if err := os.Remove(targetDirectory); err != nil {
if err := os.Remove(targetDirectory); err != nil && !os.IsNotExist(err) {
panic(err)
}

Expand Down

0 comments on commit c0fab82

Please sign in to comment.