Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
4.20.2
-
None
-
1
-
Severity 3 - Minor
-
3
-
Description
Issue Summary
Duplicating screenshots in the issue description
Steps to Reproduce
- Configure Email Request for any Service Desk Project from the [Choose a request type for email requests]
- Have it checked under JSD->Email Requests as shown below
- Compose an email and attach two images using any screenshot tool for.e g lightshot
- Capture screenshot and use copy option to paste it to the email body content
- Please note images capture would be having same name i.e image.png if view in the developer console.
- Send that email to appropriate email id configured above.
- As a result, Jira issue is created with two attachment i.e image.png and image-1.png, please note the suffice is added by Jira as par of fix in
JSDSERVER-5054 - However, notice the description, it would contain duplicate image.png.
Expected Results
- The description should contain the correct images i.e image.png and image-1.png which are renamed by Jira itself.
Actual Results
- The duplicate image is added in description field
Workaround
- None at this of writing however,
- Try to write a custom script in groovy to edit the description and correct the image name on Issue created event\
-
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
-
-
- Check if any different app is available to capture the screenshot and rename it timestamp instead of static name i.e image.png
Attachments
Issue Links
- blocks
-
JSDSERVER-6809 When attaching an image using within the email body, the comment shows an incorrect image and end up with two different images
- Closed
- is blocked by
-
PSSRV-29498 Loading...