From a0c3fac7ba25c893c89cedada092873c1e18efb9 Mon Sep 17 00:00:00 2001 From: Pavel Yurke Date: Wed, 1 Oct 2014 14:13:23 +0000 Subject: [PATCH] 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 --- .../org/alfresco/repository/upload/upload.post.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js b/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js index 5e60d02ef6..f4081664b1 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js @@ -237,10 +237,7 @@ function main() } // Update the working copy content - updateNode.properties.content.write(content); - // Reset working copy mimetype and encoding - updateNode.properties.content.guessMimetype(filename); - updateNode.properties.content.guessEncoding(); + updateNode.properties.content.write(content, false, true); // check it in again, with supplied version history note // Extract the metadata @@ -288,11 +285,7 @@ function main() if (existingFile.hasAspect("cm:versionable") && overwrite) { // Upload component was configured to overwrite files if name clashes - existingFile.properties.content.write(content); - - // Reapply mimetype as upload may have been via Flash - which always sends binary mimetype - existingFile.properties.content.guessMimetype(filename); - existingFile.properties.content.guessEncoding(); + existingFile.properties.content.write(content, false, true); // Extract the metadata // (The overwrite policy controls which if any parts of