We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fce6199 commit 265b69bCopy full SHA for 265b69b
1 file changed
src/datasets.rs
@@ -169,7 +169,7 @@ fn upload_from_file(
169
api_url: &str,
170
path: &str,
171
) -> (String, &'static str) {
172
- let f = match std::fs::File::open(path) {
+ let mut f = match std::fs::File::open(path) {
173
Ok(f) => f,
174
Err(e) => {
175
eprintln!("error opening file '{path}': {e}");
@@ -180,10 +180,7 @@ fn upload_from_file(
180
let ft = detect_from_path(path).unwrap_or_else(|| {
181
use std::io::Read;
182
let mut probe = [0u8; 512];
183
- let n = { use std::io::Read; f.read(&mut probe).unwrap_or(0) };
184
- Ok(mut f2) => f2.read(&mut probe).unwrap_or(0),
185
- Err(_) => 0,
186
- };
+ let n = f.read(&mut probe).unwrap_or(0);
187
detect_from_bytes(&probe[..n])
188
});
189
0 commit comments