diff --git a/distro/changelog.xml b/distro/changelog.xml
index 3586e5f..0818578 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -3,7 +3,10 @@
date="2018-09-19">
[Feature #11722] Workspace Uploader - Update to StorageHUB
- In case of 100% added the message "Finalising the upload of [filename]"
+ In case of 100% added the message "Finalising the upload of
+ [filename]"
+
+ [Task #12470] Check uploading of files in the Workpace by the drag and drop facility on Windows Operating System
"+msg+"";
diff --git a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/client/uploader/UploadingMessageBeforeCompleted.java b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/client/uploader/UploadingMessageBeforeCompleted.java
new file mode 100644
index 0000000..72d46a0
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/client/uploader/UploadingMessageBeforeCompleted.java
@@ -0,0 +1,73 @@
+/**
+ *
+ */
+package org.gcube.portlets.widgets.workspaceuploader.client.uploader;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * The Class UploadingMessageBeforeCompleted.
+ *
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ * Sep 19, 2018
+ */
+public class UploadingMessageBeforeCompleted {
+
+ public static String[] MESSAGES = new String[]{
+ "Finalising the upload of $",
+ "Setting the privacy policy for $",
+ "Identifying devices where to persist $",
+ "Replicating $ on multiple servers",
+ "Setting the active replica of $",
+ "Setting the access policy for $",
+ "Checking the consistency of $",
+ "Setting the business metadata for $",
+ "Accounting the operation for $"
+ };
+
+ public static int OFFSET = 15;
+
+ public static Map mapStartTime = new HashMap();
+
+
+ /**
+ * Gets the message.
+ *
+ * @param fileUploadKey the file upload key
+ * @param fileName the file name
+ * @return the message
+ */
+ public static String getMessage(String fileUploadKey, String fileName) {
+
+ if(fileUploadKey==null)
+ return MESSAGES[0].replace("$", fileName);
+
+ Long uploadingStartTime = mapStartTime.get(fileUploadKey);
+
+ if(uploadingStartTime==null){
+ uploadingStartTime = System.currentTimeMillis();
+ mapStartTime.put(fileUploadKey, uploadingStartTime);
+ }
+
+ long diff = System.currentTimeMillis() - uploadingStartTime;
+ int index = 0;
+ try{
+ //TO SEC
+ diff = diff/1000;
+ //System.out.println("DIFF TO SEC: "+diff);
+ int divResult = (int) (diff/OFFSET);
+ index = divResult>=MESSAGES.length?MESSAGES.length-1:divResult;
+ //MESSAGES.length
+ }catch(Exception e){
+ //silent
+ index = 0;
+ }
+
+ return MESSAGES[index].replace("$", fileName);
+ }
+
+
+}
+
diff --git a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/WorkspaceUploadServletStream.java b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/WorkspaceUploadServletStream.java
index b0902eb..c284237 100644
--- a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/WorkspaceUploadServletStream.java
+++ b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/WorkspaceUploadServletStream.java
@@ -486,6 +486,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
try {
//we calculate an unique name for the current destination
String itemName = fileName;
+ itemName = FilenameUtils.getBaseName(itemName); //Using base name in order to avoid Task #12470
logger.debug("getItemName from HL");
/*if(!isOverwrite){
@@ -552,7 +553,9 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
String contentType = uploadItem.getContentType();
logger.debug("Stream content type: "+contentType);
- if(uploadType.compareTo(ARCHIVE)==0){ //UPLOAD ARCHIVE
+
+ if(uploadType.compareTo(ARCHIVE)==0){
+ //UPLOAD ARCHIVE
logger.debug("Uploding archive....");
boolean isSupportedArchive = false;
@@ -585,10 +588,10 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
return;
}
- }else{ //UPLOAD FILE. IT IS DEFAULT CASE
- //I don't need to check this if(uploadType.compareTo(FILE)==0) {//IS FILE UPLOAD
- logger.debug("Uploding file....");
+ }else{
+ //UPLOAD FILE. IT IS DEFAULT CASE
+ logger.debug("Uploding file....");
workspaceUploader = WorkspaceUploaderMng.uploadFile(storageHubWrapper, user, scopeGroupId, request, workspaceUploader, request.getSession(), itemName, inputStream, destinationFolder, contentType, isOverwrite, size);
if(workspaceUploader==null)