Skip to content

Commit 3744191

Browse files
committed
dependency on Zip to use IOUtils class.
1 parent ed80c81 commit 3744191

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

plugins/tasks/resource/src/main/java/com/walmartlabs/concord/plugins/resource/ResourceTaskCommon.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
import java.util.Map;
4040
import java.util.Properties;
4141

42+
import static com.walmartlabs.concord.common.IOUtils.assertInPath;
43+
44+
//import static com.walmartlabs.concord.common.IOUtils.assertInPath;
45+
4246
public class ResourceTaskCommon {
4347

4448
private static final String RESOURCE_PREFIX = "resource_";
@@ -232,26 +236,17 @@ public static String prettyPrintYaml(Object value, int indent) throws IOExceptio
232236
return s;
233237
}
234238

235-
private Path normalizePath(String path) {
239+
private Path normalizePath(String path) throws IOException {
236240
Path p = Paths.get(path);
241+
assertWorkDirPath(path);
237242
if (p.isAbsolute()) {
238243
return p;
239244
}
240245
return workDir.resolve(path);
241246
}
242247

243-
private Path assertWorkDirPath(String path) {
244-
if (path == null) {
245-
throw new IllegalArgumentException("Path cannot be null");
246-
}
247-
Path dst = Paths.get(path);
248-
if (!dst.isAbsolute()) {
249-
dst = workDir.resolve(path).normalize().toAbsolutePath();
250-
}
251-
if (!dst.startsWith(workDir)) {
252-
throw new IllegalArgumentException("Invalid path: " + path);
253-
}
254-
return dst;
248+
private Path assertWorkDirPath(String path) throws IOException {
249+
return assertInPath(workDir, path);
255250
}
256251

257252
private static ObjectWriter createYamlWriter() {

0 commit comments

Comments
 (0)