fix a bug in the add torrent via file in browsers other than FF

This commit is contained in:
Damien Churchill 2009-07-29 10:17:10 +00:00
commit 97a7890a28
3 changed files with 15 additions and 10 deletions

View file

@ -95,12 +95,14 @@ Ext.deluge.add.FileWindow = Ext.extend(Ext.deluge.add.Window, {
onUploadSuccess: function(fp, upload) { onUploadSuccess: function(fp, upload) {
this.hide(); this.hide();
var filename = upload.result.toString(); if (upload.result.success) {
this.form.getForm().findField('torrentFile').setValue(''); var filename = upload.result.files[0];
Deluge.Client.web.get_torrent_info(filename, { this.form.getForm().findField('torrentFile').setValue('');
success: this.onGotInfo, Deluge.Client.web.get_torrent_info(filename, {
scope: this, success: this.onGotInfo,
filename: filename scope: this,
}); filename: filename
});
}
} }
}); });

File diff suppressed because one or more lines are too long

View file

@ -156,9 +156,12 @@ class Upload(resource.Resource):
os.write(fd, upload) os.write(fd, upload)
os.close(fd) os.close(fd)
filenames.append(fn) filenames.append(fn)
request.setHeader("content-type", "text/plain") request.setHeader("content-type", "text/html")
request.setResponseCode(http.OK) request.setResponseCode(http.OK)
return "\n".join(filenames) return common.json.dumps({
'success': True,
'files': filenames
})
class Render(resource.Resource): class Render(resource.Resource):