Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-65939

getTemporaryWebAttachment doesn't return any TemporaryWebAttachment

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • High
    • 7.6.1, 7.7.0
    • 7.5.0, 7.5.1, 7.5.2, 7.5.3, 7.5.4
    • Java API

    Description

      Summary

      In JIRA 7.5, there're a few issues with uploading attachments on a transition screen. These issues make attachment management unreliable, affecting JIRA notifications as well as add-ons that rely on attachment related events.

      Steps to reproduce

      1. Install JIRA 7.5
      2. Configure a workflow transition in which:
        • A validator is set e.g. user must have Delete All Attachments permission to perform the transition (but any permission or validator will do)
        • An event is triggerred from a postfunction e.g. Generic Event, Issue Updated event
        • A transition screen is popped up that includes the Attachment field
      3. Configure the permission scheme so that Delete All Attachments permission is NOT granted to anyone (the purpose is to Fail the validator)
      4. Transition an issue using the transition in step #2 following these steps:
        • Click the transition button to show the transition screen
        • Attach a file to the Attachment field and transition (refer below for the Behaviors)
      5. Configure the permission scheme so that Delete All Attachments permission is granted to your user account (the purpose is to Pass the validator)
      6. Repeat step #4

      Expected behaviors

      • At step #4, since the Validator fails, the attachment is NOT added to the issue
      • At step #6, since the Validator passes, the attachment is added and the notification event should record this - works in JIRA 7.4:

      Actual behaviors

      • At step #4, the Validator fails, however the attachment is still ADDED to the issue
      • At step #6, the Validator passes and the event is fired, however the email doesn't show that an attachment was added:

      Notes

      • When a file is attached to the Attachment field on the transition screen, JIRA logs the followings:
        2017-09-25 17:59:17,155 http-nio-8080-exec-13 WARN admin 1079x1482x1 14y3zz0 10.60.2.10 /secure/CommentAssignIssue.jspa [c.a.j.web.util.DefaultWebAttachmentManager] Temporary attachment missing: temp6551281033883185756
        2017-09-25 17:59:17,155 http-nio-8080-exec-13 WARN admin 1079x1482x1 14y3zz0 10.60.2.10 /secure/CommentAssignIssue.jspa [c.a.j.issue.fields.AttachmentSystemField] There were errors while converting temporary attachments: AttachmentError{logMessage='Temporary attachment missing: temp6551281033883185756', localizedMessage='Unable to find temporary attachment.', filename='#temp6551281033883185756', reason=SERVER_ERROR, exception=none()}
        
      • According to fcarmario@gmail.com, the potential cause is:

        Method getTemporaryWebAttachment of TemporaryWebAttachmentManager doesn't return any TemporaryWebAttachment since version 7.5.0 of JIRA. In previous versions it worked correctly.
        I have also tried method getTemporaryWebAttachmentsByFormToken as a possible alternative but it doesn't work too.

        Fidel also points out the problematic code here.

      • When a file is attached using More -> Attach files, there's NO problem
      • There're reports that, at step #6, not only does the email not show that an attachment was added, but the added attachment also does not appear in the Issue's History

      Attachments

        Issue Links

          Activity

            People

              tkanafa Tomasz Kanafa
              jsjauwmook Jeffrey Sjauw Mook (Inactive)
              Votes:
              40 Vote for this issue
              Watchers:
              44 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: