mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-19 07:14:22 +01:00
runitme-rs: unify base64 encoding for direct-volume
Direct-volume needs to use the same base64 character set as kata-runtime/direct-volume does. Fixes: #8175 Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -480,14 +480,14 @@ impl<H> StorageHandlerManager<H> {
|
||||
|
||||
/// Join user provided volume path with kata direct-volume root path.
|
||||
///
|
||||
/// The `volume_path` is base64-encoded and then safely joined to the `prefix`
|
||||
/// The `volume_path` is base64-url-encoded and then safely joined to the `prefix`
|
||||
pub fn join_path(prefix: &str, volume_path: &str) -> Result<PathBuf> {
|
||||
if volume_path.is_empty() {
|
||||
return Err(anyhow!("volume path must not be empty"));
|
||||
}
|
||||
let b64_encoded_path = base64::encode(volume_path.as_bytes());
|
||||
let b64_url_encoded_path = base64::encode_config(volume_path.as_bytes(), base64::URL_SAFE);
|
||||
|
||||
Ok(safe_path::scoped_join(prefix, b64_encoded_path)?)
|
||||
Ok(safe_path::scoped_join(prefix, b64_url_encoded_path)?)
|
||||
}
|
||||
|
||||
/// get DirectVolume mountInfo from mountinfo.json.
|
||||
|
||||
Reference in New Issue
Block a user