Commit 99e13ff3 authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

erp5_officejs: mappingstorage: save filename

parent 0763cfb4
......@@ -391,13 +391,25 @@
&& mapping_dict[attachment_id] !== undefined
&& mapping_dict[attachment_id].put !== undefined
&& mapping_dict[attachment_id].put.erp5_put_template !== undefined) {
return getSubStorageId(storage, id)
.push(function (sub_id) {
var url = UriTemplate.parse(
mapping_dict[attachment_id].put.erp5_put_template
).expand({id: sub_id}),
return new RSVP.Queue()
.push(function () {
return RSVP.all([
getSubStorageId(storage, id),
storage.get(id)
]);
})
.push(function (result) {
var sub_id = result[0],
doc = result[1],
url = UriTemplate.parse(
mapping_dict[attachment_id].put.erp5_put_template
).expand({id: sub_id}),
data = new FormData();
data.append("field_my_file", blob);
if (doc.filename) {
data.append("field_my_file", blob, doc.filename);
} else {
data.append("field_my_file", blob);
}
data.append("form_id", "File_view");
return jIO.util.ajax({
"type": "POST",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment