Ilseq is the correct error when osstring cant be turned into string

This commit is contained in:
Pat Hickey
2021-01-04 16:04:00 -08:00
parent c7fcc34487
commit 10a84727fa
2 changed files with 2 additions and 5 deletions

View File

@@ -273,10 +273,7 @@ impl WasiDir for cap_std::fs::Dir {
let meta = entry.metadata()?; let meta = entry.metadata()?;
let inode = meta.ino(); let inode = meta.ino();
let filetype = FileType::from(&meta.file_type()); let filetype = FileType::from(&meta.file_type());
let name = entry let name = entry.file_name().into_string().map_err(|_| Error::Ilseq)?;
.file_name()
.into_string()
.map_err(|_| Error::Utf8(todo!()))?;
let namelen = name.as_bytes().len().try_into()?; let namelen = name.as_bytes().len().try_into()?;
let entity = ReaddirEntity { let entity = ReaddirEntity {
next: ReaddirCursor::from(ix as u64 + 1), next: ReaddirCursor::from(ix as u64 + 1),

View File

@@ -744,7 +744,7 @@ impl<'a> wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
.read_link(path.deref())? .read_link(path.deref())?
.into_os_string() .into_os_string()
.into_string() .into_string()
.map_err(|_| Error::Utf8(todo!()))?; .map_err(|_| Error::Ilseq)?;
let link_bytes = link.as_bytes(); let link_bytes = link.as_bytes();
let link_len = link_bytes.len(); let link_len = link_bytes.len();
if link_len > buf_len as usize { if link_len > buf_len as usize {