Skip to content
This repository was archived by the owner on May 12, 2020. It is now read-only.

Commit 2f8cc2b

Browse files
committed
Make security update for windows a bit more clear
1 parent 7089117 commit 2f8cc2b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/main/java/ru/yandex/qatools/embed/postgresql/PackagePaths.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public FileSet getFileSet(Distribution distribution) {
4747
try {
4848
return FileSet.builder()
4949
.addEntry(FileType.Executable, tempDir.asFile().getPath(),
50-
"^.*pgsql\\\\bin\\\\"+ cmdPattern+ "$")
51-
.addEntry(FileType.Executable, tempDir.asFile().getPath(),
50+
"^.*pgsql\\\\bin\\\\" + cmdPattern + "$")
51+
.addEntry(FileType.Executable, tempDir.asFile().getPath(),
5252
"^.*pgsql/bin/" + cmdPattern + "$")
5353
.build();
5454
} catch (Exception e) {
@@ -76,7 +76,7 @@ public ArchiveType getArchiveType(Distribution distribution) {
7676

7777
@Override
7878
public String getPath(Distribution distribution) {
79-
String sversion = getVersionPart(distribution.getVersion());
79+
String downloadVersion = getVersionPart(distribution.getVersion());
8080

8181
ArchiveType archiveType = getArchiveType(distribution);
8282
String sarchiveType;
@@ -125,8 +125,20 @@ public String getPath(Distribution distribution) {
125125
case B64:
126126
switch (distribution.getPlatform()) {
127127
case Linux:
128+
bitsize = "-x64";
129+
break;
128130
case Windows:
129131
bitsize = "-x64";
132+
// win x64 has different download paths
133+
// See https://github.com/yandex-qatools/postgresql-embedded/issues/109
134+
switch (downloadVersion) {
135+
case "10.1-1":
136+
downloadVersion = "10.1-2";
137+
break;
138+
case "9.6.6-1":
139+
downloadVersion = "9.6.6-2";
140+
break;
141+
}
130142
break;
131143
case OS_X:
132144
break;
@@ -140,18 +152,6 @@ public String getPath(Distribution distribution) {
140152
throw new IllegalArgumentException("Unknown BitSize " + distribution.getBitsize());
141153
}
142154

143-
String path = "postgresql-" + sversion + "-" + splatform + bitsize + "-binaries" + "." + sarchiveType;
144-
switch (path) {
145-
case "postgresql-10.1-1-windows-x64-binaries.zip":
146-
path = "postgresql-10.1-2-windows-x64-binaries.zip";
147-
break;
148-
case "postgresql-9.6.6-1-windows-x64-binaries.zip":
149-
path = "postgresql-9.6.6-2-windows-x64-binaries.zip";
150-
break;
151-
default:
152-
// no path change needed
153-
break;
154-
}
155-
return path;
155+
return "postgresql-" + downloadVersion + "-" + splatform + bitsize + "-binaries" + "." + sarchiveType;
156156
}
157157
}

0 commit comments

Comments
 (0)