Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When mentioning recently added attachments through the attachments button, the comment is automatically added as thumbnail #506

Closed
gastaldelloa opened this issue Mar 22, 2020 · 2 comments · Fixed by #517
Assignees
Labels
Type/Bug Something isn't working

Comments

@gastaldelloa
Copy link

Expected Results:
The attachment would be mentioned in the following format since it's an image:

[^attachment_name.txt]

Actual Results:

!attachment_name.txt!

The file is automatically mentioned as thumbnail which results in an error when adding the comment as thumbnail since the file isn't an image

Unable to embed resource: attachment_name.txt of type text/plain

Please review the issue.go at the following function:

	go func() {
		conf := ji.GetPlugin().getConfig()
		extraText := ""
		for _, fileId := range post.FileIds {
			mattermostName, jiraName, e := client.AddAttachment(api, attach.IssueKey, fileId, conf.maxAttachmentSize)
			if e != nil {
				notifyOnFailedAttachment(ji, mattermostUserId, attach.IssueKey, e, "file: %s", mattermostName)
			}

			extraText += "\n\nAttachment: !" + jiraName + "!"
		}
		if extraText == "" {
			return
		}

		jiraComment.ID = commentAdded.ID
		jiraComment.Body += extraText
		_, err = client.UpdateComment(attach.IssueKey, &jiraComment)
		if err != nil {
			notifyOnFailedAttachment(ji, mattermostUserId, attach.IssueKey, err, "failed to completely update comment with attachments")
		}
	}()
@levb levb added Triage Type/Bug Something isn't working labels Mar 24, 2020
@aaronrothschild
Copy link
Contributor

@gastaldelloa Could you send a screenshot of where this is occurring?

@gastaldelloa
Copy link
Author

@gastaldelloa Could you send a screenshot of where this is occurring?

images.zip

Aaron, here enclosed you can find the step by step images to reproduce the issue. Basically I created a new comment with a simple attachment text file, then I attach the comment to an existing JIRA issue and the result in the JIRA issue is the available attachment but the link in the comment has the "Unable to embed resource" error. This is due to the wrong way to include a not image attachment as described.
Hope this help you. I'm available for any further information about.

@larkox larkox linked a pull request Apr 3, 2020 that will close this issue
larkox added a commit that referenced this issue Apr 24, 2020
* Recognize embeddable attachments and just link the rest of the attachments

* Fix and add missing mimes and change them to array form

* Add mp4 as embeddable item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type/Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants