Skip to content

Commit

Permalink
Merge pull request #74 from tigattack/fix/teams-character-encoding
Browse files Browse the repository at this point in the history
fix: HTML encode timestamps for MS Teams
  • Loading branch information
tigattack authored Apr 2, 2024
2 parents 5488772 + 454ed83 commit bff38fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions AlertSender.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ $Config = $Config | ConvertFrom-Json
# Import modules.
Import-Module Veeam.Backup.PowerShell -DisableNameChecking
Get-Item "$PSScriptRoot\resources\*.psm1" | Import-Module
Add-Type -AssemblyName System.Web


# Start logging if logging is enabled in config
Expand Down
10 changes: 5 additions & 5 deletions resources/NotificationHandler.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ function New-TeamsPayload {
}
@{
type = 'TextBlock'
text = "$((Get-Date -UFormat '%d %B %Y %R').ToString())"
text = [System.Web.HttpUtility]::HtmlEncode((Get-Date -UFormat '%d %B %Y %R').ToString())
wrap = $true
isSubtle = $true
spacing = 'None'
Expand Down Expand Up @@ -354,11 +354,11 @@ function New-TeamsPayload {
}
@{
title = 'Start Time'
value = "$timestampStart"
value = [System.Web.HttpUtility]::HtmlEncode($timestampStart)
}
@{
title = 'End Time'
value = "$timestampEnd"
value = [System.Web.HttpUtility]::HtmlEncode($timestampEnd)
}
@{
title = 'Duration'
Expand Down Expand Up @@ -404,11 +404,11 @@ function New-TeamsPayload {
@{ type = 'FactSet'; facts = @(
@{
title = 'Start Time'
value = "$timestampStart"
value = [System.Web.HttpUtility]::HtmlEncode($timestampStart)
}
@{
title = 'End Time'
value = "$timestampEnd"
value = [System.Web.HttpUtility]::HtmlEncode($timestampEnd)
}
@{
title = 'Duration'
Expand Down

0 comments on commit bff38fe

Please sign in to comment.