Skip to content

Commit

Permalink
Merge pull request #3596 from Xiol/issue-3555-cross-platform-paths
Browse files Browse the repository at this point in the history
fix: Cross-platform path handling for OVF FileArchive uploads
  • Loading branch information
dougm authored Oct 21, 2024
2 parents c0321f8 + 36ee9a1 commit 15e0e96
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ovf/importer/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,8 @@ type FileArchive struct {

func (t *FileArchive) Open(name string) (io.ReadCloser, int64, error) {
fpath := name
if name != t.Path {
index := strings.LastIndex(t.Path, "/")
if index != -1 {
fpath = t.Path[:index] + "/" + name
}
if name != t.Path && !filepath.IsAbs(name) {
fpath = filepath.Join(filepath.Dir(t.Path), name)
}

return t.OpenFile(fpath)
Expand Down

0 comments on commit 15e0e96

Please sign in to comment.