report.setErrorMessage("Incorrect extension specified on filename [" + archiveName + "]. Expected ["
+ expectedExtension + "]");
return;
}
Configuration deployTimeConfiguration = details.getDeploymentTimeConfiguration();
String deployDirectory = deployTimeConfiguration.getSimple("deployDirectory").getStringValue();
// Verify the user did not enter a path that represents a security issue:
// - No absolute directories; must be relative to the configuration path
// - Cannot contain parent directory references
File testPath = new File(deployDirectory);
if (testPath.isAbsolute()) {
throw new RuntimeException("Path to deploy (deployDirectory) must be a relative path. Path specified: "
+ deployDirectory);
}
if (deployDirectory.contains("..")) {
throw new RuntimeException(
"Path to deploy (deployDirectory) may not reference the parent directory. Path specified: "
+ deployDirectory);
}
// Perform the deployment
FileContentDelegate deployer = new FileContentDelegate(new File(getConfigurationPath(), deployDirectory),
"", details.getPackageTypeName());
PropertySimple zipProperty = deployTimeConfiguration.getSimple("deployZipped");
if (zipProperty != null && zipProperty.getBooleanValue() != null) {
boolean zip = zipProperty.getBooleanValue();
File tempDir = resourceContext.getTemporaryDirectory();