summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-04-04 16:03:11 +0200
committerMartin Polden <mpolden@mpolden.no>2022-04-04 16:58:42 +0200
commit49e7a8c8cee5e93317593bbd1253f555327e7482 (patch)
tree5a75654f740a5a9b6a0dd7875b3fcf4f387ec5e7 /configserver
parentf63021cc39577c2a985ab725f8cb1529607c65d8 (diff)
Allow single-dot segments in configserver
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStream.java7
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStreamTest.java2
2 files changed, 5 insertions, 4 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStream.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStream.java
index 30fbfd48f78..6f141e3e6ad 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStream.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStream.java
@@ -43,11 +43,12 @@ public class CompressedApplicationInputStream implements AutoCloseable {
*/
public static CompressedApplicationInputStream createFromCompressedStream(InputStream is, String contentType) {
try {
+ Options options = Options.standard().allowDotSegment(true);
switch (contentType) {
case ApplicationApiHandler.APPLICATION_X_GZIP:
- return new CompressedApplicationInputStream(ArchiveStreamReader.ofTarGzip(is, Options.standard()));
+ return new CompressedApplicationInputStream(ArchiveStreamReader.ofTarGzip(is, options));
case ApplicationApiHandler.APPLICATION_ZIP:
- return new CompressedApplicationInputStream(ArchiveStreamReader.ofZip(is, Options.standard()));
+ return new CompressedApplicationInputStream(ArchiveStreamReader.ofZip(is, options));
default:
throw new BadRequestException("Unable to decompress");
}
@@ -87,7 +88,7 @@ public class CompressedApplicationInputStream implements AutoCloseable {
while ((file = reader.readNextTo(tmpStream)) != null) {
tmpStream.close();
log.log(Level.FINE, "Creating output file: " + file.path());
- Path dstFile = dir.resolve(file.path().toString());
+ Path dstFile = dir.resolve(file.path().toString()).normalize();
Files.createDirectories(dstFile.getParent());
Files.move(tmpFile, dstFile);
tmpFile = createTempFile(dir);
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStreamTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStreamTest.java
index e8c7cff4e75..61642d33e62 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStreamTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStreamTest.java
@@ -158,7 +158,7 @@ public class CompressedApplicationInputStreamTest {
private static File createTarGz(String appDir) throws IOException, InterruptedException {
File tmpTar = File.createTempFile("myapp", ".tar");
- Process p = new ProcessBuilder("tar", "-C", appDir, "--exclude=.svn", "--strip-components=1", "-cvf", tmpTar.getAbsolutePath(), ".").start();
+ Process p = new ProcessBuilder("tar", "-C", appDir, "-cvf", tmpTar.getAbsolutePath(), ".").start();
p.waitFor();
p = new ProcessBuilder("gzip", tmpTar.getAbsolutePath()).start();
p.waitFor();