Skip to content

Commit

Permalink
normalize volume.target to drop trailing slash
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Oct 15, 2024
1 parent fb8e04d commit 97c49fc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions loader/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package loader

import (
"fmt"
"path"
"strconv"
"strings"

Expand Down Expand Up @@ -102,6 +103,17 @@ func Normalize(dict map[string]any, env types.Mapping) (map[string]any, error) {
}
}

if v, ok := service["volumes"]; ok {
volumes := v.([]any)
for i, volume := range volumes {
vol := volume.(map[string]any)
target := vol["target"].(string)
vol["target"] = path.Clean(target)
volumes[i] = vol
}
service["volumes"] = volumes
}

if n, ok := service["volumes_from"]; ok {
volumesFrom := n.([]any)
for _, v := range volumesFrom {
Expand Down

0 comments on commit 97c49fc

Please sign in to comment.