Revision 4123152d src/gr/grnet/pithos/web/client/FileUploadDialog.java
b/src/gr/grnet/pithos/web/client/FileUploadDialog.java | ||
---|---|---|
127 | 127 |
|
128 | 128 |
final Hidden auth = new Hidden("X-Auth-Token", ""); |
129 | 129 |
panel.add(auth); |
130 |
upload.setName("file");
|
|
130 |
upload.setName("X-Object-Data");
|
|
131 | 131 |
filenameLabel.setText(""); |
132 | 132 |
filenameLabel.setVisible(false); |
133 | 133 |
filenameLabel.setStyleName("props-labels"); |
... | ... | |
195 | 195 |
|
196 | 196 |
// Unfortunately the results are never empty, even in |
197 | 197 |
// the absense of errors, so we have to check for '<pre></pre>'. |
198 |
if (results != null && !results.equalsIgnoreCase("<pre></pre>")) { |
|
198 |
if (results != null && results.length() > 0 && !results.equalsIgnoreCase("<pre></pre>")) {
|
|
199 | 199 |
GWT.log(results, null); |
200 | 200 |
app.displayError(results); |
201 | 201 |
} |
... | ... | |
245 | 245 |
filenameLabel.setVisible(true); |
246 | 246 |
|
247 | 247 |
if (getFileForName(fname) == null) { |
248 |
doUpload(apath);
|
|
248 |
form.submit();
|
|
249 | 249 |
} |
250 | 250 |
else { |
251 | 251 |
// We are going to update an existing file, so show a confirmation dialog. |
... | ... | |
267 | 267 |
} |
268 | 268 |
} |
269 | 269 |
|
270 |
private void doUpload(String path) { |
|
271 |
PutRequest createFile = new PutRequest(path) { |
|
272 |
@Override |
|
273 |
public void onSuccess(Resource result) { |
|
274 |
form.submit(); |
|
275 |
} |
|
276 |
|
|
277 |
@Override |
|
278 |
public void onError(Throwable t) { |
|
279 |
GWT.log("", t); |
|
280 |
if (t instanceof RestException) { |
|
281 |
app.displayError("Unable to create file:" + ((RestException) t).getHttpStatusText()); |
|
282 |
} |
|
283 |
else |
|
284 |
app.displayError("System error creating file:" + t.getMessage()); |
|
285 |
} |
|
286 |
}; |
|
287 |
createFile.setHeader("X-Auth-Token", app.getToken()); |
|
288 |
createFile.setHeader("Content-Length", "0"); |
|
289 |
Scheduler.get().scheduleDeferred(createFile); |
|
290 |
} |
|
291 |
|
|
292 | 270 |
/** |
293 | 271 |
* Returns the file name from a potential full path argument. Apparently IE |
294 | 272 |
* insists on sending the full path name of a file when uploading, forcing |
Also available in: Unified diff