Uploaded image for project: 'Alfresco'
  1. Alfresco
  2. ALF-21813

MIME type does not change when the content is changed

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.1
    • Fix Version/s: None
    • Component/s: Repository
    • Security Level: external (External user)
    • Labels:
    • Security Severity:
      None

      Description

      When an user wants to upload a new version for an existing document using a different mimetype, Alfresco does not update the extension or the mime type property.

      I tried to apply the solution presented https://github.com/keensoft/alfresco-summit-2014/tree/master/10-enhancements/08-rename-on-change-ext/rename-on-change-ext-repo
      but I found out that the behaviour does not work, as the values from before and after are, in different execution (it's being fired for every event):
      Creating DOCX
      before NULL, after DOCX

      Uploading a PDF
      before NULL, after DOCX
      before DOCX, after DOCX
      before PDF, after PDF

      Because of that, there is no way to detect the change with the behaviour.
      The problem is that the upload webscript is ignoring the mime type.

      Based on that, I have back ported the upload webscript controller from 5.2, and made some changes, and now, combining the behaviour AND the upload controller, it's working, having Alfresco correctly setting both the extension and the mime type property.

      I have a sample project that can be used to simulate the problem I'm describing here. I'm attaching it to this issue.

      This problem is related with the issue reported at https://issues.alfresco.com/jira/browse/MNT-16328

      All the changes I made on the upload.js file are marked by comments starting with DGCloud.

      The exptected behaviour:
      Create: document.docx (extension docx and mime type microsoft office)
      Upload: document.pdf (extension pdf and mime type adobe pdf)
      Upload: image.jpg (extension jpg and mime type jpg)

      The current behaviour:
      Create: document.docx (extension docx and mime tpe microsoft office)
      Upload: document.pdf (extension remains docx and mime type microsoft office)

      Suggested fix
      Simply back porting the upload.js file and changing the update name and mime type is not enough, as the upload.js will also update the full name, and that's not the behavior we need.
      All we need is that the base name remains, and the extension and mime type are changed.
      In order to "fix" that, I have commented the line 289, //updateNode.setName(newFilename);

      I hope this can help you to understand the problem.

      Notes from the reporter:

      • Previous values are not injected properly to ContentServicePolicies.
      • OnContentPropertyUpdatePolicy event does not fire when uploading a new version using a different mime type
      • The 5.2 code appears to address the problem, though I haven't yet tested in that release.

        Attachments

          Issue Links

            Activity

            Hide
            resplin Richard Esplin added a comment -

            Thank you for reporting this issue. Can you reproduce it on the latest release of Community Edition?

            Your report suggests that it is fixed in 5.2, so is this issue simply documenting the problem for other people and we can close it?

            Show
            resplin Richard Esplin added a comment - Thank you for reporting this issue. Can you reproduce it on the latest release of Community Edition? Your report suggests that it is fixed in 5.2, so is this issue simply documenting the problem for other people and we can close it?
            Hide
            resplin Richard Esplin added a comment -

            Douglas explained to me that he didn't test this in 5.2, but the code that addresses it appears to be in 5.2.

            This was fixed as part of a service pack (see MNT-14924) and is still being merged to all Enterprise Edition releases. We believe that it is fixed in the current releases of Community Edition.

            Show
            resplin Richard Esplin added a comment - Douglas explained to me that he didn't test this in 5.2, but the code that addresses it appears to be in 5.2. This was fixed as part of a service pack (see MNT-14924 ) and is still being merged to all Enterprise Edition releases. We believe that it is fixed in the current releases of Community Edition.

              People

              • Assignee:
                closedissues Closed Issues
                Reporter:
                douglascrp Douglas Cassiano Rodrigues Paes
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: