Skip to content

Commit 6519e55

Browse files
committed
address copilot comments
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 6941097 commit 6519e55

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/UploadManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ protected void deleteEntitySymlinkRootDirectoryIfNeeded(DeleteEntityDownloadURLC
399399
return;
400400
}
401401
logger.info("Deleting symlink root directory: {} for {}", rootDir, cmd.getExtractUrl());
402-
Path rootDirPath = Path.of(BASE_EXTRACT_PATH + rootDir);
402+
Path rootDirPath = Path.of(BASE_EXTRACT_PATH, rootDir);
403403
String failMsg = "Failed to delete symlink root directory: {} for {}";
404404
try {
405405
if (!FileUtil.deleteRecursively(rootDirPath)) {

services/secondary-storage/server/src/test/java/org/apache/cloudstack/storage/template/UploadManagerImplTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,10 @@ public void deletesSymlinkRootDirectoryWhenValidUuid() {
7575
uploadManager.deleteEntitySymlinkRootDirectoryIfNeeded(mock(DeleteEntityDownloadURLCommand.class), validLinkPath);
7676
fileUtilMock.verify(() -> FileUtil.deleteRecursively(any(Path.class)), times(1));
7777
}
78-
}
78+
79+
@Test
80+
public void deletesSymlinkRootDirectoryWhenNoFile() {
81+
String validLinkPath = "123e4567-e89b-12d3-a456-426614174000";
82+
uploadManager.deleteEntitySymlinkRootDirectoryIfNeeded(mock(DeleteEntityDownloadURLCommand.class), validLinkPath);
83+
fileUtilMock.verify(() -> FileUtil.deleteRecursively(any(Path.class)), times(1));
84+
}}

0 commit comments

Comments
 (0)