Skip to content

Commit

Permalink
fix error_code usage
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Dec 2, 2023
1 parent 23c7b52 commit 91f33c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/s3_auto_ranged_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,15 +757,15 @@ static void s_s3_auto_ranged_get_request_finished(
break;
}

if (error_code != AWS_ERROR_SUCCESS) {
if (error_code == AWS_ERROR_S3_INVALID_RESPONSE_STATUS &&
if (request_error_code != AWS_ERROR_SUCCESS) {
if (request_error_code == AWS_ERROR_S3_INVALID_RESPONSE_STATUS &&
request->send_data.response_status == AWS_HTTP_STATUS_CODE_412_PRECONDITION_FAILED &&
!auto_ranged_get->initial_message_has_if_match_header) {
/* Use more clear error code as we added the if-match header under the hood. */
error_code = AWS_ERROR_S3_OBJECT_MODIFIED;
request_error_code = AWS_ERROR_S3_OBJECT_MODIFIED;
}
aws_s3_meta_request_set_fail_synced(meta_request, request, error_code);
if (error_code == AWS_ERROR_S3_RESPONSE_CHECKSUM_MISMATCH) {
aws_s3_meta_request_set_fail_synced(meta_request, request, request_error_code);
if (request_error_code == AWS_ERROR_S3_RESPONSE_CHECKSUM_MISMATCH) {
/* It's a mismatch of checksum, tell user that we validated the checksum and the algorithm we validated
*/
meta_request->synced_data.finish_result.did_validate = true;
Expand Down

0 comments on commit 91f33c0

Please sign in to comment.