Spaces:
Sleeping
Sleeping
Update src/main.rs
Browse files- src/main.rs +3 -2
src/main.rs
CHANGED
|
@@ -173,15 +173,16 @@ async fn upload_litematic(State(state): State<AppState>, body_bytes: axum::body:
|
|
| 173 |
let slice = &states[i..end];
|
| 174 |
|
| 175 |
let mut raw_bytes = Vec::with_capacity(slice.len() * 8);
|
|
|
|
| 176 |
for &val in slice {
|
| 177 |
raw_bytes.extend_from_slice(&val.to_be_bytes());
|
| 178 |
}
|
| 179 |
-
|
| 180 |
let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default());
|
| 181 |
encoder.write_all(&raw_bytes).map_err(|e| e.to_string())?;
|
| 182 |
encoder.flush().map_err(|e| e.to_string())?;
|
| 183 |
let compressed_bytes = encoder.finish().map_err(|e| e.to_string())?;
|
| 184 |
-
|
| 185 |
let b64_string = BASE64.encode(&compressed_bytes);
|
| 186 |
chunks.push(b64_string);
|
| 187 |
i = end;
|
|
|
|
| 173 |
let slice = &states[i..end];
|
| 174 |
|
| 175 |
let mut raw_bytes = Vec::with_capacity(slice.len() * 8);
|
| 176 |
+
|
| 177 |
for &val in slice {
|
| 178 |
raw_bytes.extend_from_slice(&val.to_be_bytes());
|
| 179 |
}
|
| 180 |
+
|
| 181 |
let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default());
|
| 182 |
encoder.write_all(&raw_bytes).map_err(|e| e.to_string())?;
|
| 183 |
encoder.flush().map_err(|e| e.to_string())?;
|
| 184 |
let compressed_bytes = encoder.finish().map_err(|e| e.to_string())?;
|
| 185 |
+
|
| 186 |
let b64_string = BASE64.encode(&compressed_bytes);
|
| 187 |
chunks.push(b64_string);
|
| 188 |
i = end;
|