Skip to content

Commit

Permalink
fs/manifest.go: mkDirPath(): skip empty path elements
Browse files Browse the repository at this point in the history
When the path string supplied to mkDirPath() has sequences of
consecutive '/' characters, or is empty (which can happen during
`ops pkg load` command execution), the filesystem code was creating
tuple attributes with emtpy symbols, which are useless.
This commit fixes it.
  • Loading branch information
francescolavra committed Aug 12, 2021
1 parent e65d2e5 commit b1db597
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/manifest.go
Expand Up @@ -521,11 +521,11 @@ func (m *Manifest) MkdirPath(path string) {
}

func mkDirPath(parent map[string]interface{}, path string) map[string]interface{} {
path = strings.TrimPrefix(path, "/")
path = strings.TrimSuffix(path, "/")
parts := strings.Split(path, "/")
for _, element := range parts {
parent = mkDir(parent, element)
if element != "" {
parent = mkDir(parent, element)
}
}
return parent
}

0 comments on commit b1db597

Please sign in to comment.