weizhouapache commented on code in PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#discussion_r1192290042
##########
services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java:
##########
@@ -1997,6 +1997,17 @@ private void savePostUploadPSK(String psk) {
}
}
+ protected String getSnapshotFilepathForDelete(String path, String
snapshotName) {
+ String finalPath = path + "/*" + snapshotName + "*";
+ if (!path.endsWith(snapshotName)) {
+ return finalPath;
+ }
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug(String.format("Snapshot file %s is present in the
same name directory %s. Deleting the directory", snapshotName, path));
+ }
+ return path;
+ }
Review Comment:
@shwstppr
would it be safer to check if the path is a directory and there is no files
in the directory before deletion ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]