Skip to content

Commit

Permalink
Exclude the property mimetype on post (issue softwareloop#67)
Browse files Browse the repository at this point in the history
* No need to set the mimetype property, alfresco adds this in the CreateFile
method (ScriptNode class),
* An empty value or not, gives mimetype value "Binary File" in all cases. So
do not send the property "prop_mimetype".
  • Loading branch information
sprouvez committed Jan 23, 2015
1 parent 3022722 commit 3731896
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
Expand Up @@ -178,8 +178,10 @@
Alfresco.logger.debug("Current:", current);
if (fileInfo.propertyData.hasOwnProperty(current) &&
(current.indexOf("prop_") === 0 || current.indexOf("assoc_") === 0)) {
Alfresco.logger.debug("Appending", current);
formData.append(current, fileInfo.propertyData[current]);
if (current != "prop_mimetype") {
Alfresco.logger.debug("Appending", current);
formData.append(current, fileInfo.propertyData[current]);
}
}
}
}
Expand Down Expand Up @@ -250,8 +252,10 @@
for (var current in fileInfo.propertyData) {
if (fileInfo.propertyData.hasOwnProperty(current) &&
(current.indexOf("prop_") === 0 || current.indexOf("assoc_") === 0)) {
customFormData += rn + "Content-Disposition: form-data; name=\"" + current + "\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.propertyData[current])) + rn + "--" + multipartBoundary + "--";
if (current != "prop_mimetype") {
customFormData += rn + "Content-Disposition: form-data; name=\"" + current + "\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.propertyData[current])) + rn + "--" + multipartBoundary + "--";
}
}
}
}
Expand Down
Expand Up @@ -203,8 +203,10 @@
Alfresco.logger.debug("Current:", current);
if (fileInfo.propertyData.hasOwnProperty(current) &&
(current.indexOf("prop_") === 0 || current.indexOf("assoc_") === 0)) {
Alfresco.logger.debug("Adding attribute", current);
attributes[current] = fileInfo.propertyData[current];
if (current != "prop_mimetype") {
Alfresco.logger.debug("Adding attribute", current);
attributes[current] = fileInfo.propertyData[current];
}
}
}
}
Expand Down
Expand Up @@ -130,12 +130,14 @@
Alfresco.logger.debug("Current:", current);
if (propertyData.hasOwnProperty(current) &&
(current.indexOf("prop_") === 0 || current.indexOf("assoc_") === 0)) {
Alfresco.logger.debug("Adding property", current);
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", current);
input.setAttribute("value", propertyData[current]);
submitForm.appendChild(input);
if (current != "prop_mimetype") {
Alfresco.logger.debug("Adding property", current);
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", current);
input.setAttribute("value", propertyData[current]);
submitForm.appendChild(input);
}
}
}

Expand Down

0 comments on commit 3731896

Please sign in to comment.