This is an automated email from the ASF dual-hosted git repository.
mpochatkin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new c5f343742c9 IGNITE-27749 Detect case difference in folders in zip
deployment units (#7535)
c5f343742c9 is described below
commit c5f343742c9bbd08ddb26758049bd2a2cc4fcea8
Author: Vadim Pakhnushev <[email protected]>
AuthorDate: Wed Feb 11 12:18:32 2026 +0300
IGNITE-27749 Detect case difference in folders in zip deployment units
(#7535)
---
...a => ItDeploymentManagementControllerTest.java} | 33 ++++++++++++++++++----
.../rest/deployment/ZipInputStreamCollector.java | 12 ++++----
2 files changed, 32 insertions(+), 13 deletions(-)
diff --git
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/ItDeploymentManagementControllerTest.java
similarity index 92%
rename from
modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
rename to
modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/ItDeploymentManagementControllerTest.java
index 753b5e4c35f..d4f5b18594d 100644
---
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
+++
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/ItDeploymentManagementControllerTest.java
@@ -82,7 +82,7 @@ import org.junit.jupiter.api.Test;
* Integration test for REST controller {@link DeploymentManagementController}.
*/
@MicronautTest(rebuildContext = true)
-public class DeploymentManagementControllerTest extends
ClusterPerClassIntegrationTest {
+public class ItDeploymentManagementControllerTest extends
ClusterPerClassIntegrationTest {
private static final String NODE_URL = "http://localhost:" +
ClusterConfiguration.DEFAULT_BASE_HTTP_PORT;
private Path smallFile;
@@ -213,17 +213,24 @@ public class DeploymentManagementControllerTest extends
ClusterPerClassIntegrati
@Test
public void testZipDeployFailedWithCaseInsensitiveDuplicates() throws
IOException {
- Path zipFileWithDuplicates = WORK_DIR.resolve("zipWithDuplicates.zip");
+ Path zipFileWithDuplicateFiles =
WORK_DIR.resolve("zipWithDuplicateFiles.zip");
+ Path zipFileWithDuplicateFolders =
WORK_DIR.resolve("zipWithDuplicateFolders.zip");
- createZipWithCaseVariantEntries(zipFileWithDuplicates);
+ createZipWithCaseVariantFiles(zipFileWithDuplicateFiles);
+ createZipWithCaseVariantFolders(zipFileWithDuplicateFolders);
if (isCaseInsensitiveFileSystem()) {
assertThrowsProblem(
- () -> deploy(UNIT_ID, VERSION, true,
zipFileWithDuplicates),
+ () -> deploy(UNIT_ID, VERSION, true,
zipFileWithDuplicateFiles),
isProblem().withStatus(BAD_REQUEST).withDetail(containsString("ZIP contains
case-insensitive duplicate: testfile.txt"))
);
+ assertThrowsProblem(
+ () -> deploy(UNIT_ID, "1.1.2", true,
zipFileWithDuplicateFolders),
+
isProblem().withStatus(BAD_REQUEST).withDetail(containsString("ZIP contains
case-insensitive duplicate: testfolder"))
+ );
} else {
- assertThat(deploy(UNIT_ID, VERSION, true, zipFileWithDuplicates),
hasStatus(OK));
+ assertThat(deploy(UNIT_ID, VERSION, true,
zipFileWithDuplicateFiles), hasStatus(OK));
+ assertThat(deploy(UNIT_ID, "1.1.2", true,
zipFileWithDuplicateFolders), hasStatus(OK));
}
}
@@ -234,7 +241,7 @@ public class DeploymentManagementControllerTest extends
ClusterPerClassIntegrati
return file;
}
- private static void createZipWithCaseVariantEntries(Path zipPath) throws
IOException {
+ private static void createZipWithCaseVariantFiles(Path zipPath) throws
IOException {
try (ZipOutputStream zos = new
ZipOutputStream(Files.newOutputStream(zipPath))) {
// Add first entry
ZipEntry entry1 = new ZipEntry("TestFile.txt");
@@ -250,6 +257,20 @@ public class DeploymentManagementControllerTest extends
ClusterPerClassIntegrati
}
}
+ private static void createZipWithCaseVariantFolders(Path zipPath) throws
IOException {
+ try (ZipOutputStream zos = new
ZipOutputStream(Files.newOutputStream(zipPath))) {
+ // Add first entry
+ ZipEntry entry1 = new ZipEntry("TestFolder/");
+ zos.putNextEntry(entry1);
+ zos.closeEntry();
+
+ // Add second entry with same name but different case
+ ZipEntry entry2 = new ZipEntry("testfolder/");
+ zos.putNextEntry(entry2);
+ zos.closeEntry();
+ }
+ }
+
private static boolean isCaseInsensitiveFileSystem() throws IOException {
// Check if filesystem is case-insensitive by testing if we can detect
the case variation
Path probeFile = WORK_DIR.resolve("CaseSensitivityProbe");
diff --git
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/ZipInputStreamCollector.java
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/ZipInputStreamCollector.java
index aa5eedb78a8..0d80b6a2e2d 100644
---
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/ZipInputStreamCollector.java
+++
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/ZipInputStreamCollector.java
@@ -119,13 +119,11 @@ public class ZipInputStreamCollector implements
InputStreamCollector {
try (ZipFile zf = new ZipFile(zipPath.toFile())) {
Enumeration<? extends ZipEntry> entries = zf.entries();
while (entries.hasMoreElements()) {
- ZipEntry entry = entries.nextElement();
- if (!entry.isDirectory()) {
- String lowerName =
entry.getName().toLowerCase(Locale.ROOT);
- if (!seenLowercase.add(lowerName)) {
- throw new DuplicateFilenamesException(
- "ZIP contains case-insensitive duplicate: " +
entry.getName());
- }
+ String entryName = entries.nextElement().getName();
+ String lowerName = entryName.toLowerCase(Locale.ROOT);
+ if (!seenLowercase.add(lowerName)) {
+ throw new DuplicateFilenamesException(
+ "ZIP contains case-insensitive duplicate: " +
entryName);
}
}
} catch (IOException e) {