diff --git a/libpod/container_internal_common.go b/libpod/container_internal_common.go index ab16c18743..f3747b5c44 100644 --- a/libpod/container_internal_common.go +++ b/libpod/container_internal_common.go @@ -416,8 +416,7 @@ func (c *Container) generateSpec(ctx context.Context) (s *spec.Spec, cleanupFunc m := &g.Config.Mounts[i] var options []string for _, o := range m.Options { - if strings.HasPrefix(o, "subpath=") { - subpath := strings.Split(o, "=")[1] + if subpath, ok := strings.CutPrefix(o, "subpath="); ok { safeMount, err := c.safeMountSubPath(m.Source, subpath) if err != nil { return nil, nil, err diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go index a302365f24..83953487ac 100644 --- a/test/e2e/run_volume_test.go +++ b/test/e2e/run_volume_test.go @@ -1113,7 +1113,7 @@ RUN chmod 755 /test1 /test2 /test3`, ALPINE) mkvol.WaitWithDefaultTimeout() Expect(mkvol).Should(ExitCleanly()) - subvol := "/test/test2/" + subvol := "/test/a=b/" pathInCtr := "/mnt" pathToCreate := filepath.Join(pathInCtr, subvol) popvol := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/mnt", volName), ALPINE, "sh", "-c", fmt.Sprintf("mkdir -p %s; touch %s; touch %s", pathToCreate, filepath.Join(pathToCreate, "foo"), filepath.Join(pathToCreate, "bar"))})