aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/api_wrappers.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-21 17:09:10 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-21 17:09:10 -0800
commitc1c01caf6b40343bd876e10961829e2b15a9c37c (patch)
treecb26627fe194cbd878ad9c5912dce2feef2c1c8d /rust/src/api_wrappers.rs
parent86f37a5df6f94d7736be736d0a440ae65425d6c9 (diff)
downloadfatcat-c1c01caf6b40343bd876e10961829e2b15a9c37c.tar.gz
fatcat-c1c01caf6b40343bd876e10961829e2b15a9c37c.zip
verify checksum against regexes
Diffstat (limited to 'rust/src/api_wrappers.rs')
-rw-r--r--rust/src/api_wrappers.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs
index fe9cd793..c3df7d72 100644
--- a/rust/src/api_wrappers.rs
+++ b/rust/src/api_wrappers.rs
@@ -102,6 +102,8 @@ macro_rules! wrap_entity_handlers {
message: ErrorKind::InvalidFatcatId(e).to_string() }),
Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
$post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::MalformedChecksum(e), _)) =>
+ $post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::NotInControlledVocabulary(e), _)) =>
$post_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::EditgroupAlreadyAccepted(e), _)) =>
@@ -141,6 +143,8 @@ macro_rules! wrap_entity_handlers {
message: ErrorKind::InvalidFatcatId(e).to_string() }),
Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
$post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::MalformedChecksum(e), _)) =>
+ $post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::NotInControlledVocabulary(e), _)) =>
$post_batch_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::EditgroupAlreadyAccepted(e), _)) =>
@@ -185,6 +189,8 @@ macro_rules! wrap_entity_handlers {
message: ErrorKind::InvalidFatcatId(e).to_string() }),
Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
$update_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::MalformedChecksum(e), _)) =>
+ $update_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::NotInControlledVocabulary(e), _)) =>
$update_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::EditgroupAlreadyAccepted(e), _)) =>
@@ -431,6 +437,8 @@ macro_rules! wrap_lookup_handler {
$get_resp::NotFound(ErrorResponse { message: format!("Not found: {:?} / {:?}", $idname, wikidata_qid) }),
Err(Error(ErrorKind::MalformedExternalId(e), _)) =>
$get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
+ Err(Error(ErrorKind::MalformedChecksum(e), _)) =>
+ $get_resp::BadRequest(ErrorResponse { message: e.to_string() }),
Err(Error(ErrorKind::MissingOrMultipleExternalId(e), _)) => {
$get_resp::BadRequest(ErrorResponse { message: e.to_string(), }) },
Err(Error(ErrorKind::OtherBadRequest(e), _)) =>
@@ -706,6 +714,11 @@ impl Api for Server {
message: e.to_string(),
})
}
+ Err(Error(ErrorKind::MalformedChecksum(e), _)) => {
+ LookupFileResponse::BadRequest(ErrorResponse {
+ message: e.to_string(),
+ })
+ }
Err(Error(ErrorKind::MissingOrMultipleExternalId(e), _)) => {
LookupFileResponse::BadRequest(ErrorResponse {
message: e.to_string(),