Microsoft Teams 在文本中转义下划线 [英] Microsoft Teams escaping underscores in text
本文介绍了Microsoft Teams 在文本中转义下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 ruby 中有以下功能可以通过 webhook 将 aws 日志发送到微软团队频道.有些文本包含下划线符号,如 connection_web
,但在 MS 团队中看起来像 connectionweb
.如何获得准确的输出?
I have following function in ruby to send aws logs to microsoft team channel through webhook. Some text contains underscore signs like connection_web
but appears like connectionweb
in MS teams. How to get the exact output ?
require 'json'
require 'net/https'
require 'uri'
require 'base64'
require 'zlib'
require 'stringio'
def lambda_handler(event:, context:)
log_event = JSON.parse(decode_and_decompress(event["awslogs"]["data"]))
response = speak(messages_from_blob(log_event))
puts response.body
end
def speak(message)
http = Net::HTTP.new("MS-Teamwebhook.com", 443)
http.use_ssl = true
request = Net::HTTP::Post.new(ENV["HOOK_URL"])
request.body = JSON.generate({
text: message
})
http.request(request)
end
def decode_and_decompress(input)
binary_compressed = Base64.decode64(input)
gz = Zlib::GzipReader.new(StringIO.new(binary_compressed))
gz.read
end
def messages_from_blob(event_data)
event_data["logEvents"]
.map{ |e| e["message"] }
.join("\n")
end
推荐答案
我们为此提出了一个错误,相关团队正在解决这个问题.
We have raised a bug for this and concerned team is working on it.
这篇关于Microsoft Teams 在文本中转义下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文