From c4a7bb9c8b12b47138a4172d868b52b60ce2e4d8 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Thu, 14 Oct 2021 23:33:03 +0200 Subject: Fix ntfs-shell `get` command for a given $DATA stream. --- examples/ntfs-shell/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/ntfs-shell/main.rs b/examples/ntfs-shell/main.rs index 3df1b59..e4b8a22 100644 --- a/examples/ntfs-shell/main.rs +++ b/examples/ntfs-shell/main.rs @@ -466,8 +466,10 @@ where T: Read + Seek, { // Extract any specific $DATA stream name from the file. - let mid = arg.find(':').unwrap_or(arg.len()); - let (file_name, data_stream_name) = arg.split_at(mid); + let (file_name, data_stream_name) = match arg.find(':') { + Some(mid) => (&arg[..mid], &arg[mid + 1..]), + None => (arg, ""), + }; // Compose the output file name and try to create it. // It must not yet exist, as we don't want to accidentally overwrite things. -- cgit v1.2.3