Skip to content

Commit 8dd796f

Browse files
Escaped new lines in InfoCommand
Fixed urlwatcher not creating .notified files
1 parent 6919451 commit 8dd796f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

NotifierBot/Sources/Notifier/Commands/InfoCommand.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ struct InfoCommand: Command {
7373
let errorDuration = Date().timeIntervalSince(errorDate)
7474
errorDurationString = SharedUtils.muteDurationFormatter.string(from: errorDuration)
7575
}
76-
lines.append("- Errored: \(errored ? "Yes (for \(errorDurationString ?? "an unknown time"))" : "No")")
76+
lines.append("- Errored: \(errored ? "Yes (for \(errorDurationString ?? "an unknown time"))" : "No")".escaped())
7777
let notified = FileManager.default.fileExists(atPath: "\(entryPath)/.notified")
78-
lines.append(" - Notified: \(notified ? "Yes" : "No")")
78+
lines.append(" - Notified: \(notified ? "Yes" : "No")".escaped())
7979
return lines.joined(separator: "\n")
8080
}
8181

urlwatcher/Sources/urlwatcher/Functions.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ func handleScreenshotError(entry: URLEntry) throws {
170170
// Check if the user has already been notified
171171
if fileManager.fileExists(atPath: "\(entryPath)/.notified") {
172172
// User has already been notified
173+
print("User already notified.")
173174
return
174175
}
175176

@@ -185,8 +186,8 @@ func handleScreenshotError(entry: URLEntry) throws {
185186
// and create the "notified" file to indicate that the user has already been notified about this error
186187
try notifyError(entry: entry)
187188
let notifiedFile = "\(SharedUtils.directory(for: entry))/.notified"
188-
if fileManager.fileExists(atPath: notifiedFile) {
189-
try fileManager.removeItem(atPath: notifiedFile)
189+
if !fileManager.fileExists(atPath: notifiedFile) {
190+
fileManager.createFile(atPath: notifiedFile, contents: nil)
190191
}
191192
}
192193
}

0 commit comments

Comments
 (0)