Skip to content

Commit

Permalink
Check on backslash on isKeyForDirectorySet method
Browse files Browse the repository at this point in the history
  • Loading branch information
bhattmanish98 committed Feb 20, 2025
1 parent 6f5a3a3 commit 47eccd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public class AbfsConfiguration{
private int producerQueueMaxSize;

@IntegerConfigurationValidatorAnnotation(ConfigurationKey =
FS_AZURE_CONSUMER_MAX_LAG, DefaultValue = DEFAULT_FS_AZURE_CONSUMER_MAX_LAG)
FS_AZURE_CONSUMER_MAX_LAG, DefaultValue = DEFAULT_FS_AZURE_CONSUMER_MAX_LAG)
private int listingMaxConsumptionLag;

@IntegerConfigurationValidatorAnnotation(ConfigurationKey =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,13 @@ private static String replacedUrl(String baseUrl, String oldString, String newSt
*/
public static boolean isKeyForDirectorySet(String key, Set<String> dirSet) {
for (String dir : dirSet) {
if (dir.isEmpty() || key.startsWith(
dir + AbfsHttpConstants.FORWARD_SLASH)) {
// Ensure the directory ends with a forward slash
if (StringUtils.isNotEmpty(dir)
&& !dir.endsWith(AbfsHttpConstants.FORWARD_SLASH)) {
dir += AbfsHttpConstants.FORWARD_SLASH;
}
// Return true if the directory is empty or the key starts with the directory
if (dir.isEmpty() || key.startsWith(dir)) {
return true;
}

Expand Down

0 comments on commit 47eccd5

Please # to comment.