Skip to content

Commit 0806b00

Browse files
committed
Don't panic when file size exceed the limit
1 parent caecbde commit 0806b00

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,10 @@ impl MainHandler {
581581
}
582582
Ok(())
583583
}
584-
SaveResult::Partial(_entries, reason) => {
585-
Err((status::InternalServerError, reason.unwrap_err().to_string()))
586-
}
584+
SaveResult::Partial(_entries, reason) => Err((
585+
status::InternalServerError,
586+
format!("save file failed: {:?}", reason),
587+
)),
587588
SaveResult::Error(error) => {
588589
Err((status::InternalServerError, error.to_string()))
589590
}
@@ -942,7 +943,7 @@ impl MainHandler {
942943

943944
match range {
944945
Some(Range::Bytes(ranges)) => {
945-
if let Some(range) = ranges.get(0) {
946+
if let Some(range) = ranges.first() {
946947
let (offset, length) = match *range {
947948
ByteRangeSpec::FromTo(x, mut y) => {
948949
// "x-y"

0 commit comments

Comments
 (0)