Skip to content

Commit 08bb8ce

Browse files
authoredApr 8, 2024··
Merge pull request #1924 from eclipse-ditto/bugfix/fix-if-match-headers-weak-etag-handling
fix weak eTag handling of If-Match and If-None-Match headers
2 parents 6ee7ce0 + c2a8f06 commit 08bb8ce

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
 

‎internal/utils/conditional-headers/src/main/java/org/eclipse/ditto/internal/utils/headers/conditional/IfMatchPreconditionHeader.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ public boolean meetsConditionFor(@Nullable final EntityTag entityTag) {
5959
return false;
6060
}
6161

62-
return entityTagsToMatch.stream().anyMatch(entityTagToMatch -> entityTagToMatch.strongMatch(entityTag));
62+
return entityTagsToMatch.stream().anyMatch(entityTagToMatch -> {
63+
if (entityTag.isWeak()) {
64+
return entityTagToMatch.weakMatch(entityTag);
65+
} else {
66+
return entityTagToMatch.strongMatch(entityTag);
67+
}
68+
});
6369
}
6470

6571
/**

‎internal/utils/conditional-headers/src/main/java/org/eclipse/ditto/internal/utils/headers/conditional/IfNoneMatchPreconditionHeader.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ public boolean meetsConditionFor(@Nullable final EntityTag entityTag) {
5656
return true;
5757
}
5858

59-
return entityTagsToMatch.stream().noneMatch(entityTagToMatch -> entityTagToMatch.weakMatch(entityTag));
59+
return entityTagsToMatch.stream().noneMatch(entityTagToMatch -> {
60+
if (entityTag.isWeak()) {
61+
return entityTagToMatch.weakMatch(entityTag);
62+
} else {
63+
return entityTagToMatch.strongMatch(entityTag);
64+
}
65+
});
6066
}
6167

6268
/**

0 commit comments

Comments
 (0)
Please sign in to comment.