Skip to content

Commit

Permalink
fix(ZNTA-2744): prevent raw download on non-file project (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
djansen-redhat authored and definite committed Aug 13, 2018
1 parent 88cdac7 commit 8b50de8
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,7 @@ public boolean isZipFileDownloadAllowed() {
}

public boolean isPoProject() {
HProjectIteration projectIteration =
projectIterationDAO.getBySlug(projectSlug, versionSlug);
HProjectIteration projectIteration = getVersion();
ProjectType type = projectIteration.getProjectType();
if (type == null) {
type = projectIteration.getProject().getDefaultProjectType();
Expand All @@ -701,9 +700,7 @@ && getVersion().getProjectType() != ProjectType.Podir) {
}

public boolean isKnownProjectType() {
ProjectType type = projectIterationDAO
.getBySlug(projectSlug, versionSlug).getProjectType();
return type != null;
return getVersion().getProjectType() != null;
}

public boolean isFileUploadAllowed(HLocale hLocale) {
Expand Down Expand Up @@ -769,6 +766,9 @@ public String translationExtensionOf(String docPath, String docName) {
}

public boolean hasOriginal(String docPath, String docName) {
if (!isKnownProjectType() || getVersion().getProjectType() != ProjectType.File) {
return false;
}
GlobalDocumentId id = new GlobalDocumentId(projectSlug, versionSlug,
docPath + docName);
return filePersistService.hasPersistedDocument(id);
Expand Down

0 comments on commit 8b50de8

Please sign in to comment.