I discovered a very annoying issue that you cannot easily turn of the Versionable Aspect when using the Share client, not by any simple properties setting (bahh….humbug!).So I saw a post where someone on the Alfresco engineering team (MikeH) said from https://forums.alfresco.com/en/viewtopic.php?f=47&t=22666#p74408:You just need to override org/alfresco/repository/upload/upload.post to remove the forced versioning.
Ok, great. :shock: I open up upload.post.js, but am not sure how to code the override. Any help would be appreciated. THis is the code block I believe needs to be modified:
.
.
.
if (!updateNode.hasAspect("cm:workingcopy"))
{
// Ensure the original file is versionable - may have been uploaded via different route
if (!updateNode.hasAspect("cm:versionable"))
{
// Ensure the file is versionable
var props = new Array(1);
props["cm:autoVersionOnUpdateProps"] = false;
updateNode.addAspect("cm:versionable", props);
}
if (updateNode.versionHistory == null)
{
// Create the first version manually so we have 1.0 before checkout
updateNode.createVersion("", true);
}
// It's not a working copy, do a check out to get the actual working copy
updateNode = updateNode.checkoutForUpload();
}
// 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();
// check it in again, with supplied version history note
updateNode = updateNode.checkin(description, majorVersion);
model.document = updateNode;
}
else
{
/**
* Upload new file to destNode (calculated earlier) + optional subdirectory
*/
if (uploadDirectory !== null && uploadDirectory.length > 0)
{
destNode = destNode.childByNamePath(uploadDirectory);
if (destNode === null)
{
status.code = 404;
status.message = "Cannot upload file since upload directory '" + uploadDirectory + "' does not exist.";
status.redirect = true;
return;
}
}
/**
* Exitsing file handling.
*/
var existingFile = destNode.childByNamePath(filename);
if (existingFile !== null)
{
// File already exists, decide what to do
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.save();
model.document = existingFile;
// We're finished - bail out here
return;
}
.
.
.
.