File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -113,10 +113,10 @@ toAnnotation v = do
113113 title' <- title
114114 let annotation =
115115 mconcat
116- [ " ::" <> level' <> " " ,
116+ [ " ::" <> escapeSpecial level' <> " " ,
117117 location,
118- " title=" <> title' <> " ::" ,
119- message'
118+ " title=" <> escapeSpecial title' <> " ::" ,
119+ escapeNewlines message'
120120 ]
121121 return $ escapeNewlines annotation <> " \n "
122122 where
@@ -153,7 +153,7 @@ locationAnnotation v =
153153 ]
154154 where
155155 fileAnnotation
156- | (Just s) <- filename = " file=" <> s <> " , "
156+ | (Just s) <- filename = " file=" <> escapeSpecial s <> " , "
157157 | otherwise = " "
158158
159159 colAnnotation
@@ -214,3 +214,7 @@ locationAnnotation v =
214214-- See https://github.com/actions/toolkit/issues/193.
215215escapeNewlines :: Text -> Text
216216escapeNewlines = replace " \n " " %0A"
217+
218+ -- | Escape special characters which can interfere with the parsing of an annotation.
219+ escapeSpecial :: Text -> Text
220+ escapeSpecial = replace " :" " %3A" . replace " ," " %2C" . escapeNewlines
You can’t perform that action at this time.
0 commit comments