Implemented ability to send error data along with user feedback in case of error
[pithos-web-client] / src / gr / grnet / pithos / web / client / commands / PasteCommand.java
index a6c8f10..639050b 100644 (file)
@@ -48,6 +48,7 @@ import java.util.List;
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.http.client.Response;
+import com.google.gwt.http.client.URL;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.ui.PopupPanel;
 
@@ -144,6 +145,7 @@ public class PasteCommand implements Command {
                 @Override
                 public void onError(Throwable t) {
                     GWT.log("", t);
+                                       app.setError(t);
                     if (t instanceof RestException) {
                         app.displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText());
                     }
@@ -157,7 +159,7 @@ public class PasteCommand implements Command {
                                }
             };
             copyFile.setHeader("X-Auth-Token", app.getToken());
-            copyFile.setHeader("X-Move-From", file.getUri());
+            copyFile.setHeader("X-Move-From", URL.encodePathSegment(file.getUri()));
             copyFile.setHeader("Content-Type", file.getContentType());
             Scheduler.get().scheduleDeferred(copyFile);
         }