Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-5054

Pasting screenshots with the same name in the Customer Portal results in duplicate image display

      Problem

      Pasting screenshots with the same name in the Customer Portal will not display the images correctly.

      Steps to reproduce the problem

      1. Create a new request via Customer Portal.
      2. Take a screenshot anywhere and paste it to the request by using shortcut key Ctrl + V, example name of the screenshot would be image.png.
      3. Take another screenshot and paste it again. The name of the second screenshot might also be image.png.
      4. Upload the screenshots.

      Expected result

      Two different screenshots will be uploaded and displayed

      Actual result

      Two screenshots are uploaded, however, they look exactly the same in the request. However, the screenshots are uploaded correctly to JIRA and displayed correctly in the JIRA issue

      Workaround

      Use tools to take screenshots which will give different names to the image. For example, the print screen tool of a MacBook machine will use the timestamp when the image is taken as the name of the file instead of a generic name

      Fix suggestion

      Allow the user to pick a name for the screen-short at the time of attaching it.

        1. atlassian image addition bug.png
          atlassian image addition bug.png
          141 kB
        2. Error_DuplicatedImages.webm
          3.41 MB
        3. image-2018-01-11-17-13-34-935.png
          image-2018-01-11-17-13-34-935.png
          32 kB
        4. image-2018-01-11-17-13-36-545.png
          image-2018-01-11-17-13-36-545.png
          32 kB
        5. Screen Shot 2019-11-25 at 11.13.44 AM.png
          Screen Shot 2019-11-25 at 11.13.44 AM.png
          1.56 MB
        6. Screen Shot 2019-11-25 at 11.14.14 AM.png
          Screen Shot 2019-11-25 at 11.14.14 AM.png
          1.02 MB
        7. Screen Shot 2019-11-25 at 11.14.14 AM.png
          Screen Shot 2019-11-25 at 11.14.14 AM.png
          1.02 MB
        8. untitled2.mp4
          749 kB

          Form Name

            [JSDSERVER-5054] Pasting screenshots with the same name in the Customer Portal results in duplicate image display

            Why is this issue closed as fixed if I am still observing the issue?

            Deleted Account (Inactive) added a comment - Why is this issue closed as fixed if I am still observing the issue?

            BrianW added a comment -

            This was still happening on Atlassian's support instance in February.  Are they not up to date?

            BrianW added a comment - This was still happening on Atlassian's support instance in February.  Are they not up to date?

            SteveM added a comment -

            @brian.weichel1 it was fixed in Jira Service Desk 4.1

            SteveM added a comment - @brian.weichel1 it was fixed in Jira Service Desk 4.1

            BrianW added a comment -

            Just spent a couple frustrating weeks with support while they tried to figure this out.  Bugs need fixed.

            BrianW added a comment - Just spent a couple frustrating weeks with support while they tried to figure this out.  Bugs need fixed.

            Hello it happends again now on your portal

            Katya Godneva added a comment - Hello it happends again now on your portal

            Hi, this is still not solved in Jira's Enterprise release 7.13.x and we need to wait until the next enterprise release which is still not out.
            How about a bug fix for current enterprise release customers?

            Michiel Schuijer added a comment - Hi, this is still not solved in Jira's Enterprise release 7.13.x and we need to wait until the next enterprise release which is still not out. How about a bug fix for current enterprise release customers?

            So it took you 27 (twenty seven!) months to fix this, 9 months since the personal nudge to the Product Owner, 70 comments, 175 votes.

            Just stats.

            Denis Zvonov added a comment - So it took you 27 (twenty seven!) months to fix this, 9 months since the personal nudge to the Product Owner, 70 comments, 175 votes. Just stats.

            Hi,

             

            Don't know what happened to my display name. Can't even mention you guys.

            Either way I'm simply attaching the code here.

            I used Script Runner for Jira and added a new Script Listener, which listens on the event "Issue Created".

             

            import com.atlassian.jira.component.ComponentAccessor
            import com.atlassian.jira.issue.attachment.Attachment
            import org.ofbiz.core.entity.GenericValue
            import com.atlassian.jira.ofbiz.OfBizDelegator
            import java.util.Randomdef issue = event.issue
            def attachmentManager = ComponentAccessor.getAttachmentManager()
            List<Attachment> attachments = attachmentManager.getAttachments(issue)void renameAttachment(attachmentID, newName){
            	OfBizDelegator delegator = ComponentAccessor.getComponentOfType(OfBizDelegator.class)
            	for(GenericValue attachment : delegator.findByField("FileAttachment", "id", attachmentID)){ 
            		attachment.setString("filename", newName)
            		attachment.store()
                } 
            }if(attachments.size()>1){
                ArrayList<String> fileNames = new ArrayList<String>()
             	for(attachment in attachments){
                    def filename = attachment.filename
                    if(fileNames.contains(filename)){
                        fileNames.add(filename)
                        Random random = new Random()
                        String newName = new Date().format('yyyyMMddhhmmssmmm').toString() + " " + random.next(10) + " " + filename
                     	fileNames.add(newName) //in case of multiple duplicatenames
                        try{
                           renameAttachment(attachment.id, newName) 
                        }catch(exc){
                            log.warn("Exception while trying to rename attachment: " + exc)
                        }     
                    }else{
            			fileNames.add(attachment.filename)
                    }
            	}
            }
            //x 

             

            Cheers

            Gezim Shehu [Communardo] added a comment - - edited Hi,   Don't know what happened to my display name. Can't even mention you guys. Either way I'm simply attaching the code here. I used Script Runner for Jira and added a new Script Listener, which listens on the event "Issue Created".   import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.attachment.Attachment import org.ofbiz.core.entity.GenericValue import com.atlassian.jira.ofbiz.OfBizDelegator import java.util.Randomdef issue = event.issue def attachmentManager = ComponentAccessor.getAttachmentManager() List<Attachment> attachments = attachmentManager.getAttachments(issue)void renameAttachment(attachmentID, newName){ OfBizDelegator delegator = ComponentAccessor.getComponentOfType(OfBizDelegator.class) for (GenericValue attachment : delegator.findByField( "FileAttachment" , "id" , attachmentID)){ attachment.setString( "filename" , newName) attachment.store() } } if (attachments.size()>1){ ArrayList< String > fileNames = new ArrayList< String >() for (attachment in attachments){ def filename = attachment.filename if (fileNames.contains(filename)){ fileNames.add(filename) Random random = new Random() String newName = new Date().format( 'yyyyMMddhhmmssmmm' ).toString() + " " + random.next(10) + " " + filename fileNames.add(newName) //in case of multiple duplicatenames try { renameAttachment(attachment.id, newName) } catch (exc){ log.warn( "Exception while trying to rename attachment: " + exc) } } else { fileNames.add(attachment.filename) } } } //x   Cheers

            Hi Gezim, Please share link as interested in how you achieved this fix - script listener to monitor new issues created with duplicate attachments and rename appending the current timestamp.

            kind regards,
            Maria

            Maria Burrows added a comment - Hi Gezim, Please share link as interested in how you achieved this fix - script listener to monitor new issues created with duplicate attachments and rename appending the current timestamp. kind regards, Maria

            Hi @gezim_shehu, I'm not sure how to DM or even @mention you in this comment, but I am very interested in your Script Listener work around! Would you be able to post something (maybe a link to git hub or something) that we can use? Thanks so much for your post!

            Alejandro Chavarria added a comment - Hi @gezim_shehu, I'm not sure how to DM or even @mention you in this comment, but I am very interested in your Script Listener work around! Would you be able to post something (maybe a link to git hub or something) that we can use? Thanks so much for your post!

              ashubovych moofoo (Inactive)
              michin Michelle Chin
              Affected customers:
              175 This affects my team
              Watchers:
              158 Start watching this issue

                Created:
                Updated:
                Resolved: