Skip to content

Commit

Permalink
fix: Use absolute path for reading manifest
Browse files Browse the repository at this point in the history
Closes: vmware#3550
  • Loading branch information
Xiol committed Sep 18, 2024
1 parent 3450f77 commit a0bdbdb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ovf/importer/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"context"
"errors"
"fmt"
"os"
"path"
"path/filepath"
"strings"
Expand Down Expand Up @@ -61,12 +60,11 @@ type Importer struct {
func (imp *Importer) ReadManifest(fpath string) error {
base := filepath.Base(fpath)
ext := filepath.Ext(base)
mfName := strings.Replace(base, ext, ".mf", 1)
mfPath := filepath.Join(filepath.Dir(fpath), strings.Replace(base, ext, ".mf", 1))

mf, _, err := imp.Archive.Open(mfName)
mf, _, err := imp.Archive.Open(mfPath)
if err != nil {
msg := fmt.Sprintf("manifest %q: %s", mf, err)
fmt.Fprintln(os.Stderr, msg)
msg := fmt.Sprintf("failed to read manifest %q: %s", mf, err)
return errors.New(msg)
}
imp.Manifest, err = library.ReadManifest(mf)
Expand Down

0 comments on commit a0bdbdb

Please sign in to comment.