Skip to content

Commit

Permalink
Merge pull request #1450 from kubernetes-client/release-10.0.1
Browse files Browse the repository at this point in the history
Add path normalization for archive files.
  • Loading branch information
k8s-ci-robot authored Dec 21, 2020
2 parents eb0f078 + eb2cfe9 commit 858316a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@
<apache.commons.lang3.version>3.11</apache.commons.lang3.version>
<apache.commons.collections4.version>4.4</apache.commons.collections4.version>
<apache.commons.compress>1.20</apache.commons.compress>
<common.codec.version>1.15</common.codec.version>
<spring.boot.version>2.3.3.RELEASE</spring.boot.version>
<spring.version>5.2.9.RELEASE</spring.version>
<common.codec.version>1.14</common.codec.version>
<spring.boot.version>2.3.1.RELEASE</spring.boot.version>
<spring.version>5.2.8.RELEASE</spring.version>
<prometheus.client.version>0.9.0</prometheus.client.version>
<apache.commons.io>2.8.0</apache.commons.io>

<e2e.skip>true</e2e.skip>

Expand Down Expand Up @@ -103,6 +104,11 @@
<artifactId>commons-compress</artifactId>
<version>${apache.commons.compress}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${apache.commons.io}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion util/src/main/java/io/kubernetes/client/Copy.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -170,7 +171,11 @@ public void copyDirectoryFromPod(
log.error("Can't read: " + entry);
continue;
}
File f = new File(destination.toFile(), entry.getName());
String normalName = FilenameUtils.normalize(entry.getName());
if (normalName == null) {
throw new IOException("Invalid entry: " + entry.getName());
}
File f = new File(destination.toFile(), normalName);
if (entry.isDirectory()) {
if (!f.isDirectory() && !f.mkdirs()) {
throw new IOException("create directory failed: " + f);
Expand Down

0 comments on commit 858316a

Please sign in to comment.