Skip to content

Commit

Permalink
[MM-593] Added escape characters to user, repo and path in permalink …
Browse files Browse the repository at this point in the history
…preview (#803)

* [MM-593] Added escape characters to user, repo and path in permalink preview

* [MM-593] Fix lint errors
  • Loading branch information
raghavaggarwal2308 authored Jul 31, 2024
1 parent 23286a1 commit c935551
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/plugin/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ func isInsideLink(msg string, index int) bool {

// getCodeMarkdown returns the constructed markdown for a permalink.
func getCodeMarkdown(user, repo, repoPath, word, lines string, isTruncated bool) string {
user = strings.ReplaceAll(user, "_", "\\_")
repo = strings.ReplaceAll(repo, "_", "\\_")
repoPath = strings.ReplaceAll(repoPath, "_", "\\_")
final := fmt.Sprintf("\n[%s/%s/%s](%s)\n", user, repo, repoPath, word)
ext := path.Ext(repoPath)
// remove the preceding dot
Expand Down

0 comments on commit c935551

Please sign in to comment.