Skip to content

Commit 1347b4d

Browse files
committed
style(gui): format upload transcoding code
1 parent 29cd704 commit 1347b4d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

  • crates/agent-gui/src-tauri/src/commands/app

crates/agent-gui/src-tauri/src/commands/app/system.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,7 @@ fn classify_upload_text_bytes(bytes: &[u8], prefix_truncated: bool) -> UploadTex
320320
if bytes.contains(&0) {
321321
return UploadTextClass::Binary;
322322
}
323-
let stripped = bytes
324-
.strip_prefix(&[0xEF, 0xBB, 0xBF])
325-
.unwrap_or(bytes);
323+
let stripped = bytes.strip_prefix(&[0xEF, 0xBB, 0xBF]).unwrap_or(bytes);
326324
match std::str::from_utf8(stripped) {
327325
Ok(_) => return UploadTextClass::Utf8,
328326
Err(error) => {
@@ -961,8 +959,7 @@ fn import_readable_file_paths_into_workdir(
961959
.unwrap_or("file");
962960
let sanitized_name = sanitize_uploaded_file_name(source_name);
963961
let target = unique_path_for_copy(import_root.join(sanitized_name));
964-
if detected.needs_utf8_transcode
965-
&& metadata.len() <= UPLOADED_TEXT_TRANSCODE_MAX_BYTES
962+
if detected.needs_utf8_transcode && metadata.len() <= UPLOADED_TEXT_TRANSCODE_MAX_BYTES
966963
{
967964
let bytes = fs::read(&source)
968965
.map_err(|e| format!("读取文件失败 {}: {e}", source.display()))?;

0 commit comments

Comments
 (0)