Skip to content

Commit

Permalink
Upload big file differencies (#647)
Browse files Browse the repository at this point in the history
* Update hint for big file upload

* Do not delete big file after upload by default - changed cfg property.

* Refactored checking if the file should be deleted after upload.

* Remove big file metadata after every save metadata
  • Loading branch information
milanmajchrak authored May 6, 2024
1 parent 9d10a72 commit 6f37b8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,12 @@ private void uploadFileFromURL(Context context, HttpServletRequest request, Inte

wis.update(context, witem);

// remove metadata from the item, because that file was uploading after every save
itemService.clearMetadata(context, witem.getItem(), "local", "bitstream", "redirectToURL", Item.ANY);

// delete file
String shouldDeleteFile = configurationService.getProperty("delete.big.file.after.upload");
if (StringUtils.isNotBlank(shouldDeleteFile) && StringUtils.equals("true", shouldDeleteFile)) {
boolean shouldDeleteFile = configurationService.getBooleanProperty("delete.big.file.after.upload", false);
if (shouldDeleteFile) {
FileUtils.forceDelete(file);
}
}
Expand Down
4 changes: 2 additions & 2 deletions dspace/config/clarin-dspace.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ lr.help.mail = [email protected]
lr.help.phone = 0000

# Admin could upload the file bigger than maximum upload size.
# Should be this big file deleted from the '/temp' folder?
delete.big.file.after.upload = true
# Should be this big file deleted from where it was uploaded?
delete.big.file.after.upload = false


##### BITSTREAM DOWNLOAD #####
Expand Down
8 changes: 4 additions & 4 deletions dspace/config/submission-forms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@
<label>Big file URL</label>
<input-type>onebox</input-type>
<hint>
The actual maximum upload size of the file is 4GB. To upload the file bigger than maximum
upload size type the URL of that big file. Admin must know URL to that bitstream file.
Then click on the 'Save' button and the file will start to upload. The file will be loaded
from the '/temp' folder of the server. Example: /tomcat/temp/bitstream.png
The actual maximum upload size of the file is 4GB. To upload a file bigger than the
maximum upload size, enter the URL of that large file. The admin must know the URL
of that bitstream file. Then, click on the 'Save' button, and the file will start
to upload. The file path must be an absolute path.
</hint>
<required></required>
<acl>
Expand Down

0 comments on commit 6f37b8d

Please sign in to comment.