Commit c49462b8 authored by Tristan Cavelier's avatar Tristan Cavelier

davstorage.js attachments id are no longer changed

If you put {
  "_id": "a.b",
  "_attachment": "compressed.tar.gz",
  "_data": ...
}, the backend will write "a_.b.compressed.tar.gz"
instead of "a_.b.compressed_.tar_.gz"
parent 1e8e41f5
......@@ -142,7 +142,7 @@
function idsToFileName(doc_id, attachment_id) {
doc_id = secureName(doc_id).replace(/\./g, '_.');
if (typeof attachment_id === "string") {
attachment_id = secureName(attachment_id).replace(/\./g, '_.');
attachment_id = secureName(attachment_id);
return doc_id + "." + attachment_id;
}
return doc_id;
......@@ -155,15 +155,21 @@
* @return {Array} ["document id", "attachment id"] or ["document id"]
*/
function fileNameToIds(file_name) {
return file_name.replace(/.\.(?:\.)?/g, function (substr) {
if (substr[0] === '_') {
if (substr[2] === '.') {
return '. ';
}
return '.';
/*jslint regexp: true */
file_name = /^((?:_\.|[^\.])*)(?:\.(.*))?$/.exec(file_name);
if (file_name === null ||
(file_name[1] &&
file_name[1].length === 0)) {
return [];
}
if (file_name[2]) {
if (file_name[2].length > 0) {
return [restoreName(file_name[1].replace(/_\./g, '.')),
restoreName(file_name[2])];
}
return substr[0] + ' ';
}).split(' ').map(restoreName);
return [];
}
return [restoreName(file_name[1].replace(/_\./g, '.'))];
}
function promiseSucceed(promise) {
......
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