diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c351b35 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Generated references are compared byte-for-byte with the Rust renderer. +# Keep their checkout representation stable even with core.autocrlf=true. +skills/vibeshell/references/*.md text eol=lf +.claude/skills/vibeshell/references/*.md text eol=lf +.codex/skills/vibeshell/references/*.md text eol=lf diff --git a/src-tauri/src/ssh_import/putty.rs b/src-tauri/src/ssh_import/putty.rs index 1b767ba..41d862d 100644 --- a/src-tauri/src/ssh_import/putty.rs +++ b/src-tauri/src/ssh_import/putty.rs @@ -275,16 +275,20 @@ fn read_text_file(path: &Path) -> Result { let bytes = fs::read(path).with_context(|| format!("Failed to read {}", path.display()))?; if bytes.starts_with(&[0xff, 0xfe]) { let units: Vec = bytes[2..] - .chunks_exact(2) - .map(|chunk| u16::from_le_bytes([chunk[0], chunk[1]])) + .as_chunks::<2>() + .0 + .iter() + .map(|chunk| u16::from_le_bytes(*chunk)) .collect(); return String::from_utf16(&units) .with_context(|| format!("Invalid UTF-16 text in {}", path.display())); } if bytes.starts_with(&[0xfe, 0xff]) { let units: Vec = bytes[2..] - .chunks_exact(2) - .map(|chunk| u16::from_be_bytes([chunk[0], chunk[1]])) + .as_chunks::<2>() + .0 + .iter() + .map(|chunk| u16::from_be_bytes(*chunk)) .collect(); return String::from_utf16(&units) .with_context(|| format!("Invalid UTF-16 text in {}", path.display()));