commit b9c3213b90d883ab1cb66902e66100906260da53
parent 95e24ffc51db2f6834142ec86568c2d244562006
Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com>
Date: Mon, 15 Mar 2021 16:47:14 +0100
Merge pull request #1487 from jjlin/send
Send access check fixes
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/api/core/sends.rs b/src/api/core/sends.rs
@@ -197,18 +197,18 @@ fn post_access(access_id: String, data: JsonUpcase<SendAccessData>, conn: DbConn
};
if let Some(max_access_count) = send.max_access_count {
- if send.access_count > max_access_count {
+ if send.access_count >= max_access_count {
err_code!("Max access count reached", 404);
}
}
if let Some(expiration) = send.expiration_date {
- if Utc::now().naive_utc() > expiration {
+ if Utc::now().naive_utc() >= expiration {
err_code!("Send has expired", 404)
}
}
- if Utc::now().naive_utc() > send.deletion_date {
+ if Utc::now().naive_utc() >= send.deletion_date {
err_code!("Send has been deleted", 404)
}
@@ -248,18 +248,18 @@ fn post_access_file(
};
if let Some(max_access_count) = send.max_access_count {
- if send.access_count > max_access_count {
+ if send.access_count >= max_access_count {
err_code!("Max access count reached", 404);
}
}
if let Some(expiration) = send.expiration_date {
- if Utc::now().naive_utc() > expiration {
+ if Utc::now().naive_utc() >= expiration {
err_code!("Send has expired", 404)
}
}
- if Utc::now().naive_utc() > send.deletion_date {
+ if Utc::now().naive_utc() >= send.deletion_date {
err_code!("Send has been deleted", 404)
}