Skip to content

Commit fb8e5d2

Browse files
committed
fix: volume - name - replace trim_ascii_end fn call
Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>
1 parent c941b5a commit fb8e5d2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/fat/volume.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ impl VolumeName {
3636

3737
/// Get name
3838
pub fn name(&self) -> &[u8] {
39-
self.contents.trim_ascii_end()
39+
let mut bytes = &self.contents[..];
40+
while let [rest @ .., last] = bytes {
41+
if last.is_ascii_whitespace() {
42+
bytes = rest;
43+
} else {
44+
break;
45+
}
46+
}
47+
bytes
4048
}
4149

4250
/// Create a new MS-DOS volume label.

0 commit comments

Comments
 (0)