Skip to content

Commit

Permalink
Merge pull request #35 from defold/validate-yaml-before-parsing
Browse files Browse the repository at this point in the history
Validate manifest YAML before parsing.
  • Loading branch information
king-lothman authored Mar 30, 2017
2 parents e5eb9da + 846757a commit 51c1751
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server/src/main/java/com/defold/extender/Extender.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,15 @@ private File uniqueTmpFile(String prefix, String suffix) {
return file;
}

private ManifestConfiguration loadManifest(File manifest) throws IOException {
return new Yaml().loadAs(FileUtils.readFileToString(manifest), ManifestConfiguration.class);
private ManifestConfiguration loadManifest(File manifest) throws IOException, ExtenderException {
String yaml = FileUtils.readFileToString(manifest);

if (yaml.contains("\t")) {
throw new ExtenderException("Manifest files (ext.manifest) are YAML files and cannot contain tabs. " +
"Indentation should be done with spaces.");
}

return new Yaml().loadAs(yaml, ManifestConfiguration.class);
}

static List<File> filterFiles(Collection<File> files, String re) {
Expand Down

0 comments on commit 51c1751

Please sign in to comment.