Merged DEV to HEAD (5.0.0)

85514 : ACE-676 : Uploading new version of pdf sets mimetype to unknown
      - Use specialised write(content) method to ScriptNode to allow the mimetype, encoding etc. to all be calculated and applied in a single call.
      - We should not rely on mimetype sent by client.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@86155 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Pavel Yurke
2014-10-01 14:13:23 +00:00
parent 5d1fc74367
commit a0c3fac7ba

View File

@@ -237,10 +237,7 @@ function main()
} }
// Update the working copy content // Update the working copy content
updateNode.properties.content.write(content); updateNode.properties.content.write(content, false, true);
// Reset working copy mimetype and encoding
updateNode.properties.content.guessMimetype(filename);
updateNode.properties.content.guessEncoding();
// check it in again, with supplied version history note // check it in again, with supplied version history note
// Extract the metadata // Extract the metadata
@@ -288,11 +285,7 @@ function main()
if (existingFile.hasAspect("cm:versionable") && overwrite) if (existingFile.hasAspect("cm:versionable") && overwrite)
{ {
// Upload component was configured to overwrite files if name clashes // Upload component was configured to overwrite files if name clashes
existingFile.properties.content.write(content); existingFile.properties.content.write(content, false, true);
// Reapply mimetype as upload may have been via Flash - which always sends binary mimetype
existingFile.properties.content.guessMimetype(filename);
existingFile.properties.content.guessEncoding();
// Extract the metadata // Extract the metadata
// (The overwrite policy controls which if any parts of // (The overwrite policy controls which if any parts of