Skip to content

Commit 3671db2

Browse files
committed
adds in unit check for bytes
1 parent 369fcfa commit 3671db2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/audit/impl/LoggingAuditor.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,14 @@ private class LoggingAuditSpan extends AbstractAuditSpanImpl {
252252
private void attachRangeFromRequest(SdkHttpRequest request,
253253
ExecutionAttributes executionAttributes) {
254254

255-
if (executionAttributes.getAttribute(AwsExecutionAttribute.OPERATION_NAME).equals("GetObject")) {
256-
if (request.headers() != null
257-
&& request.headers().get("Range") != null) {
258-
String rangeValue = request.headers().get("Range").get(0);
259-
String rangeHeader = rangeValue.split("=")[1];
260-
referrer.set(AuditConstants.PARAM_RANGE, rangeHeader);
255+
if (executionAttributes.getAttribute(AwsExecutionAttribute.OPERATION_NAME)
256+
.equals("GetObject")) {
257+
if (request.headers() != null && request.headers().get("Range") != null) {
258+
String[] rangeHeader = request.headers().get("Range").get(0).split("=");
259+
// only set header if range unit is bytes
260+
if (rangeHeader[0].equals("bytes")) {
261+
referrer.set(AuditConstants.PARAM_RANGE, rangeHeader[1]);
262+
}
261263
}
262264
}
263265
}

0 commit comments

Comments
 (0)