Skip to content

Commit

Permalink
implements changes to the API path as discussed (#7084)
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Feb 4, 2021
1 parent 32d0fc1 commit 481c3b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/api/Datasets.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,12 @@ public Response getVersionFiles( @PathParam("id") String datasetId, @PathParam("
}

@GET
@Path("{id}/versions/{versionId}/fileaccess")
@Path("{id}/dirindex")
@Produces("text/html")
//public Response getFileAccessFolderView(@PathParam("id") String datasetId, @PathParam("versionId") String versionId, @PathParam("name") String name, @QueryParam("folder") String folderName, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context HttpServletResponse response) {
public Response getFileAccessFolderView(@PathParam("id") String datasetId, @PathParam("versionId") String versionId, @QueryParam("folder") String folderName, @QueryParam("original") Boolean originals, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context HttpServletResponse response) {
public Response getFileAccessFolderView(@PathParam("id") String datasetId, @QueryParam("version") String versionId, @QueryParam("folder") String folderName, @QueryParam("original") Boolean originals, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context HttpServletResponse response) {

folderName = folderName == null ? "" : folderName;
folderName = folderName == null ? "" : folderName;
versionId = versionId == null ? ":latest-published" : versionId;

DatasetVersion version;
try {
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1935,12 +1935,16 @@ public static String formatFolderListingHtml(String folderName, DatasetVersion v

StringBuilder sb = new StringBuilder();

sb.append(HtmlFormatUtil.formatTag("Index of folder /" + folderName + " in dataset " + persistentId, HTML_H1));
String versionTag = version.getFriendlyVersionNumber();
versionTag = "DRAFT".equals(versionTag) ? "Draft Version" : "v. " + versionTag;
sb.append(HtmlFormatUtil.formatTag("Index of folder /" + folderName +
" in dataset " + persistentId +
" (" + versionTag + ")", HTML_H1));
sb.append("\n");
sb.append(formatFolderListingTableHtml(folderName, fileMetadatas, apiLocation, originals));

String body = sb.toString();

return formatDoc(title, body);
}

Expand Down Expand Up @@ -2034,8 +2038,8 @@ private static String getFolderAccessUrl(DatasetVersion version, String currentF
}

return apiLocation + "/api/datasets/" + datasetId +
"/versions/" + versionTag +
"/fileaccess?folder=" + subFolder +
"/dirindex/?version=" + versionTag + "&" +
"folder=" + subFolder +
(originals ? "&original=true" : "");
}

Expand Down

0 comments on commit 481c3b4

Please sign in to comment.