check upload limits beforehand

This commit is contained in:
xenofem 2022-05-03 19:21:42 -04:00
parent a79e9ae99c
commit 3b974ed6a3
4 changed files with 38 additions and 15 deletions

View file

@ -139,7 +139,7 @@ struct UploadManifest {
enum ServerMessage {
Ready { code: String },
TooBig { max_size: u64 },
TooLong { max_days: u16 },
TooLong { max_lifetime: u16 },
IncorrectPassword,
Error { details: String },
}
@ -150,8 +150,8 @@ impl From<&Error> for ServerMessage {
Error::TooBig(max_size) => ServerMessage::TooBig {
max_size: *max_size,
},
Error::TooLong(max_days) => ServerMessage::TooLong {
max_days: *max_days,
Error::TooLong(max_lifetime) => ServerMessage::TooLong {
max_lifetime: *max_lifetime,
},
Error::IncorrectPassword => ServerMessage::IncorrectPassword,
_ => ServerMessage::Error {