Skip to content

Commit 6a5877d

Browse files
Fixed missing escaping in info and list command
1 parent a617f55 commit 6a5877d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

NotifierBot/Sources/Notifier/Commands/InfoCommand.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,22 @@ struct InfoCommand: Command {
3838

3939
private func infoText(for e: URLEntry) -> String {
4040
var lines = ["*\(e.name.escaped()):*"]
41-
lines.append("- URL: \(e.url.escaped())")
41+
// Escape '-' with backslash
42+
lines.append("\\- URL: \(e.url.escaped())")
4243
if e.area.height != 0 && e.area.width != 0 {
43-
lines.append("- Area: (\(e.area.x), \(e.area.y), \(e.area.width), \(e.area.height))")
44+
lines.append("\\- Area: (\(e.area.x), \(e.area.y), \(e.area.width), \(e.area.height))")
4445
}
4546
if e.delay > 0 {
46-
lines.append("- Delay: \(e.delay)")
47+
lines.append("\\- Delay: \(e.delay)")
4748
}
4849
if !e.captureElement.isEmpty {
49-
lines.append("- Capture Element: `\(e.captureElement.escaped())`")
50+
lines.append("\\- Capture Element: `\(e.captureElement.escaped())`")
5051
}
5152
if !e.clickElement.isEmpty {
52-
lines.append("- Click Element: `\(e.clickElement.escaped())`")
53+
lines.append("\\- Click Element: `\(e.clickElement.escaped())`")
5354
}
5455
if !e.waitElement.isEmpty {
55-
lines.append("- Wait Element: `\(e.waitElement.escaped())`")
56+
lines.append("\\- Wait Element: `\(e.waitElement.escaped())`")
5657
}
5758
return lines.joined(separator: "\n")
5859
}

NotifierBot/Sources/Notifier/JFUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct JFUtils {
6868
}
6969
} else {
7070
for entry in entries {
71-
list.append("- \(entry.name.escaped())")
71+
list.append("- \(entry.name)".escaped())
7272
}
7373
}
7474
return list.joined(separator: "\n")

0 commit comments

Comments
 (0)