mirror of https://github.com/docker/cli.git
review changes
- fix lint issues - use errors pkg for wrapping errors - cleanup on error when setting up secrets mount - fix erroneous import - remove unneeded switch for secret reference mode - return single mount for secrets instead of slice Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
1be644fbcf
commit
3f9494f1d6
|
@ -3,6 +3,7 @@ package service
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -31,6 +32,13 @@ func parseSecretString(secretString string) (string, string, error) {
|
||||||
} else {
|
} else {
|
||||||
targetName = secretName
|
targetName = secretName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ensure target is a filename only; no paths allowed
|
||||||
|
tDir, _ := filepath.Split(targetName)
|
||||||
|
if tDir != "" {
|
||||||
|
return "", "", fmt.Errorf("target must not have a path")
|
||||||
|
}
|
||||||
|
|
||||||
return secretName, targetName, nil
|
return secretName, targetName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue