adoroszlai commented on code in PR #8453:
URL: https://github.com/apache/ozone/pull/8453#discussion_r2199913422


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java:
##########
@@ -521,17 +521,41 @@ public static String validateAndNormalizeKey(boolean 
enableFileSystemPaths,
     }
   }
 
+  /**
+   * Normalizes the key path based on the bucket layout.
+   * Character validation is performed only if the 
keyNameCharacterCheckEnabled config is enabled.
+   *
+   * @return normalized (and optionally validated) key path
+   */
+
+  public static String normalizeKeyPath(boolean keyNameCharCheckEnabled, 
boolean enableFileSystemPaths,
+      String keyPath, BucketLayout bucketLayout) throws OMException {
+    LOG.debug("Bucket Layout: {}", bucketLayout);
+    if (bucketLayout.shouldNormalizePaths(enableFileSystemPaths)) {
+      keyPath = OmUtils.normalizeKey(keyPath, false);
+      if (keyNameCharCheckEnabled) {
+        return isValidKeyPath(keyPath);
+      }
+      checkKeyName(keyPath);

Review Comment:
   I think `normalizeKeyPath` should not validate at all.  Suppose the key was 
created with Ozone before optional "key name char check" was introduced, or 
later with the check disabled.  Now we should still be able to delete it even 
if the check is enabled.
   
   In short: if the key exists, we should be able to delete it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to