added header to file depositions

This commit is contained in:
Diamantis Tziotzios 2024-04-18 13:25:24 +03:00
parent 15692d7afa
commit 6f96367f7c
1 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ public class ZenodoDepositServiceImpl implements ZenodoDepositService {
if (links == null || !links.containsKey(ZENODO_LINKS_BUCKET)) throw new Exception("bucket not found"); if (links == null || !links.containsKey(ZENODO_LINKS_BUCKET)) throw new Exception("bucket not found");
String addFileUrl = links.get(ZENODO_LINKS_BUCKET) + "/" + pdfEnvelope.getFilename() + "?access_token=" + zenodoToken; String addFileUrl = links.get(ZENODO_LINKS_BUCKET) + "/" + pdfEnvelope.getFilename() + "?access_token=" + zenodoToken;
zenodoClient.put().uri(addFileUrl) zenodoClient.put().uri(addFileUrl).headers(httpHeaders -> httpHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM))
.body(BodyInserters .body(BodyInserters
.fromResource(new ByteArrayResource(pdfEnvelope.getFile()))) .fromResource(new ByteArrayResource(pdfEnvelope.getFile())))
.retrieve().toEntity(Map.class).block(); .retrieve().toEntity(Map.class).block();
@ -119,7 +119,7 @@ public class ZenodoDepositServiceImpl implements ZenodoDepositService {
String supportingFilesZipName = dmpDepositModel.getSupportingFilesZip().getFilename(); String supportingFilesZipName = dmpDepositModel.getSupportingFilesZip().getFilename();
addFileUrl = links.get(ZENODO_LINKS_BUCKET) + "/" + supportingFilesZipName + "?access_token=" + zenodoToken; addFileUrl = links.get(ZENODO_LINKS_BUCKET) + "/" + supportingFilesZipName + "?access_token=" + zenodoToken;
zenodoClient.put().uri(addFileUrl).body(BodyInserters.fromResource(new ByteArrayResource(supportingFilesZipName.getBytes()))).retrieve().toEntity(Map.class).block(); zenodoClient.put().uri(addFileUrl).headers(httpHeaders -> httpHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM)).body(BodyInserters.fromResource(new ByteArrayResource(supportingFilesZipName.getBytes()))).retrieve().toEntity(Map.class).block();
} }
// Third post call to Zenodo to publish the entry and return the DOI. // Third post call to Zenodo to publish the entry and return the DOI.