@@ -98,8 +98,8 @@ enum PublishError {
98
98
path : PathBuf ,
99
99
} ,
100
100
101
- #[ snafu( display( "file path {path:?} must not contain more than one component " ) ) ]
102
- InvalidComponentCount { path : PathBuf } ,
101
+ #[ snafu( display( "file path {path:?} must only contain normal components " ) ) ]
102
+ InvalidComponents { path : PathBuf } ,
103
103
104
104
#[ snafu( display( "file path {path:?} must not be absolute" ) ) ]
105
105
InvalidAbsolutePath { path : PathBuf } ,
@@ -132,7 +132,7 @@ impl From<PublishError> for Status {
132
132
PublishError :: SetDirPermissions { .. } => Status :: unavailable ( full_msg) ,
133
133
PublishError :: CreateFile { .. } => Status :: unavailable ( full_msg) ,
134
134
PublishError :: WriteFile { .. } => Status :: unavailable ( full_msg) ,
135
- PublishError :: InvalidComponentCount { .. } => Status :: unavailable ( full_msg) ,
135
+ PublishError :: InvalidComponents { .. } => Status :: unavailable ( full_msg) ,
136
136
PublishError :: InvalidAbsolutePath { .. } => Status :: unavailable ( full_msg) ,
137
137
PublishError :: TagPod { .. } => Status :: unavailable ( full_msg) ,
138
138
PublishError :: BuildAnnotation { .. } => Status :: unavailable ( full_msg) ,
@@ -257,16 +257,13 @@ impl SecretProvisionerNode {
257
257
publish_error:: InvalidAbsolutePathSnafu { path: & file_path }
258
258
) ;
259
259
260
- // Ensure that the file path only consists of a single normal
261
- // component. This prevents any path traversals up the path using
262
- // '..'.
260
+ // Ensure that the file path only contains normal components. This
261
+ // prevents any path traversals up the path using '..'.
263
262
ensure ! (
264
263
file_path
265
264
. components( )
266
- . filter( |c| matches!( c, Component :: Normal ( _) ) )
267
- . count( )
268
- == 1 ,
269
- publish_error:: InvalidComponentCountSnafu { path: & file_path }
265
+ . all( |c| matches!( c, Component :: Normal ( _) ) ) ,
266
+ publish_error:: InvalidComponentsSnafu { path: & file_path }
270
267
) ;
271
268
272
269
// Now, we can join the base and file path
0 commit comments