Skip to content

Commit

Permalink
Merge pull request #10264 from GlobalDataverseCommunityConsortium/IQS…
Browse files Browse the repository at this point in the history
…S/10251-fix_for_multifile_downloads

IQSS/10251 fix for multifile downloads
  • Loading branch information
landreev authored Jan 25, 2024
2 parents dada648 + 68f5ed2 commit 752846f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private void redirectToDownloadAPI(String downloadType, Long fileId, boolean gue
Long fileMetadataId) {
String fileDownloadUrl = FileUtil.getFileDownloadUrlPath(downloadType, fileId, guestBookRecordAlreadyWritten,
fileMetadataId);
if (downloadType.equals("GlobusTransfer")) {
if ("GlobusTransfer".equals(downloadType)) {
PrimeFaces.current().executeScript(URLTokenUtil.getScriptForUrl(fileDownloadUrl));
} else {
logger.fine("Redirecting to file download url: " + fileDownloadUrl);
Expand Down
30 changes: 4 additions & 26 deletions src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1199,34 +1199,12 @@ public static boolean isGuestbookPopupRequired(DatasetVersion datasetVersion) {
}

public static boolean isTermsPopupRequired(DatasetVersion datasetVersion) {

if (datasetVersion == null) {
logger.fine("TermsPopup not required because datasetVersion is null.");
return false;
}
//0. if version is draft then Popup "not required"
if (!datasetVersion.isReleased()) {
logger.fine("TermsPopup not required because datasetVersion has not been released.");
Boolean answer = popupDueToStateOrTerms(datasetVersion);
if(answer == null) {
logger.fine("TermsPopup is not required.");
return false;
}
// 1. License and Terms of Use:
if (datasetVersion.getTermsOfUseAndAccess() != null) {
if (!License.CC0.equals(datasetVersion.getTermsOfUseAndAccess().getLicense())
&& !(datasetVersion.getTermsOfUseAndAccess().getTermsOfUse() == null
|| datasetVersion.getTermsOfUseAndAccess().getTermsOfUse().equals(""))) {
logger.fine("TermsPopup required because of license or terms of use.");
return true;
}

// 2. Terms of Access:
if (!(datasetVersion.getTermsOfUseAndAccess().getTermsOfAccess() == null) && !datasetVersion.getTermsOfUseAndAccess().getTermsOfAccess().equals("")) {
logger.fine("TermsPopup required because of terms of access.");
return true;
}
}

logger.fine("TermsPopup is not required.");
return false;
return answer;
}

/**
Expand Down

0 comments on commit 752846f

Please sign in to comment.