Skip to content

Commit 0d2d536

Browse files
committed
apiserver: normalize inputs for ephemeral-storage
1 parent 78cb2f3 commit 0d2d536

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sources/api/apiserver/src/server/ephemeral_storage.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ pub fn bind(variant: &str, dirs: Vec<String>) -> Result<()> {
118118
_ => format!("{}{}", RAID_DEVICE_DIR, RAID_DEVICE_NAME),
119119
};
120120

121+
// Normalize input by trimming trailing "/"
122+
let dirs: Vec<String> = dirs
123+
.into_iter()
124+
.map(|dir| dir.trim_end_matches("/").to_string())
125+
.collect();
126+
121127
let mount_point = format!("/mnt/{}", EPHEMERAL_MNT);
122128
let mount_point = Path::new(&mount_point);
123129
let allowed_dirs = allowed_bind_dirs(variant);

0 commit comments

Comments
 (0)