Skip to content

Commit

Permalink
Revert "fix(sword): as of Payara 6, "attachment; " required to upload…
Browse files Browse the repository at this point in the history
… files #8305"

This reverts commit 89182c1.
  • Loading branch information
pdurbin committed Jul 27, 2023
1 parent da5193f commit 83c55a9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
3 changes: 0 additions & 3 deletions doc/release-notes/8305-payara6.md

This file was deleted.

6 changes: 1 addition & 5 deletions doc/sphinx-guides/source/api/sword.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ Differences in Dataverse Software 4 from DVN 3.x lead to a few minor backward in

- As of Dataverse Software 5.10, ``NONE`` is no longer supported as a license.

- As of Dataverse Software 6.0, when uploading files, you must supply "Content-Disposition: attachment; filename=example.zip" rather than "Content-Disposition: filename=example.zip". See :ref:`sword-add-files`.

New features as of v1.1
-----------------------

Expand Down Expand Up @@ -163,16 +161,14 @@ You must have permission to add datasets in a Dataverse collection (the Datavers
curl -u $API_TOKEN: https://$HOSTNAME/dvn/api/data-deposit/v1.1/swordv2/collection/dataverse/$DATAVERSE_ALIAS
.. _sword-add-files:

Add files to a dataset with a zip file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You must have ``EditDataset`` permission (Contributor role or above such as Curator or Admin) on the dataset to add files.

.. code-block:: bash
curl -u $API_TOKEN: --data-binary @path/to/example.zip -H "Content-Disposition: attachment; filename=example.zip" -H "Content-Type: application/zip" -H "Packaging: http://purl.org/net/sword/package/SimpleZip" https://$HOSTNAME/dvn/api/data-deposit/v1.1/swordv2/edit-media/study/doi:TEST/12345
curl -u $API_TOKEN: --data-binary @path/to/example.zip -H "Content-Disposition: filename=example.zip" -H "Content-Type: application/zip" -H "Packaging: http://purl.org/net/sword/package/SimpleZip" https://$HOSTNAME/dvn/api/data-deposit/v1.1/swordv2/edit-media/study/doi:TEST/12345
Display a dataset atom entry
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
try {
lock.lock();
mediaResourceManagerImpl.setHttpRequest(req);
// Under Payara 5 we could send "Content-Disposition: filename=example.zip"
// Under Payara 6 now must send "Content-Disposition: attachment; filename=example.zip"
// Otherwise we get "Filename could not be extracted from Content-Disposition: Expected separator ';' instead of '='"
// Use req.getHeader("Content-Disposition") to see what the client is sending.
this.api.post(req, resp);
mediaResourceManagerImpl.setHttpRequest(null);
} finally {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public static Response uploadFile(String persistentId, String zipfilename, Strin
Response swordStatementResponse = given()
.body(bytes)
.header("Packaging", "http://purl.org/net/sword/package/SimpleZip")
.header("Content-Disposition", "attachment; filename=" + zipfilename)
.header("Content-Disposition", "filename=" + zipfilename)
/**
* It's unclear why we need to add "preemptive" to auth but
* without it we can't use send bytes using the body/content
Expand All @@ -675,7 +675,7 @@ public static Response uploadZipFileViaSword(String persistentId, String pathToZ
Response swordStatementResponse = given()
.body(bytes)
.header("Packaging", "http://purl.org/net/sword/package/SimpleZip")
.header("Content-Disposition", "attachment; filename=" + zipfilename)
.header("Content-Disposition", "filename=" + zipfilename)
/**
* It's unclear why we need to add "preemptive" to auth but
* without it we can't use send bytes using the body/content
Expand Down

0 comments on commit 83c55a9

Please sign in to comment.