kasunkv / slack-notification

Slack Notification task with advanced slack message customization for Visual Studio Team Services
MIT License
20 stars 9 forks source link

NewLines in Message and Attachment Test not working #2

Open eFloh opened 6 years ago

eFloh commented 6 years ago

Hi, great extension, thanks! But to use it in conjunction e.g. with the GenerateReleaseNotes task it would be great to be able to use variables that contain newlines correctly. When a variable contains a Newline-Character, currently `n will be slacked. (i.e. the backtick from powershell special character escaping is not properly replaced. `t for tab character is the same. Maybe it would be enough to manually replace at least these two instead of creating a generic solution.

I think the replacement should be done after the JSON.Stringify calls.

Additionally, when entering SomeText\nWith a newline in the input boxes, the \n will also be masked and be part of the slack message instead of creating a newline.

Greetings, Florian

kasunkv commented 6 years ago

@eFloh Thanks for using Slack Notification task and for giving this feedback. I will make the necessary changes and release an update to the task. I will keep you updated here.. :)

gugavaro commented 5 years ago

@eFloh did you find any work around for that?

gugavaro commented 5 years ago

My suggestion is:

Message and PreText are very much the same type of field.

this would be a one line change on the task

I believe on the task input.ts file, method toJSON

change this line preText: this._preText,

to this line: preText: process.env[this._preText],

or whatever is the way to read a variable.

kamil2079 commented 2 years ago

Hey guys, thanks for your hard work.

I want to just tell you and others that for me, when using Powershel script only this works as a Newline-Character ``n and I'm not even using variables as input capability because it doesn't work for me (ver.5)

thisjustin816 commented 12 months ago

Has there been any movement on this issue? I'm currently trying to send a multiline message and can't figure out how to get the \n strings to not literally render in the message. I'm using powershell in a separate task to construct the message (and insert the \n characters) and the store in a pipeline variable which is used for input in the slack notification task.