Fixed crash when path has multiple leading slashes

pull/6/head
Tomer Froumin 2018-01-11 10:46:22 +02:00
parent 8406a547d4
commit 52f02c42e6
1 changed files with 2 additions and 5 deletions

View File

@ -378,11 +378,8 @@ func untarAll(reader io.Reader, destFile, prefix string) error {
} }
func getPrefix(file string) string { func getPrefix(file string) string {
if file[0] == '/' { // tar strips the leading '/' if it's there, so we will too
// tar strips the leading '/' if it's there, so we will too return strings.TrimLeft(file, "/")
return file[1:]
}
return file
} }
func execute(f cmdutil.Factory, cmd *cobra.Command, options *ExecOptions) error { func execute(f cmdutil.Factory, cmd *cobra.Command, options *ExecOptions) error {