filter out control characters in all other Messages

This does, as a side effect, make long notes in json output not
be indented. The indentation is only needed to offset them
underneath the display of the file they apply to, so that's ok.

Sponsored-by: Brock Spratlen on Patreon
This commit is contained in:
Joey Hess 2023-04-10 17:03:41 -04:00
parent a0e6fa18eb
commit 8b6c7bdbcc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
54 changed files with 183 additions and 164 deletions

View file

@ -16,7 +16,6 @@ import Text.Feed.Query
import Text.Feed.Types
import qualified Data.Set as S
import qualified Data.Map as M
import Data.Char
import Data.Time.Clock
import Data.Time.Format
import Data.Time.Calendar
@ -95,9 +94,9 @@ getFeed addunlockedmatcher opts cache url = do
go tmpf = liftIO (parseFeedFromFile' tmpf) >>= \case
Nothing -> debugfeedcontent tmpf "parsing the feed failed"
Just f -> do
case map sanitizetitle $ decodeBS $ fromFeedText $ getFeedTitle f of
case decodeBS $ fromFeedText $ getFeedTitle f of
"" -> noop
t -> showNote ('"' : t ++ "\"")
t -> showNote (UnquotedString ('"' : t ++ "\""))
case findDownloads url f of
[] -> debugfeedcontent tmpf "bad feed content; no enclosures to download"
l -> do
@ -107,9 +106,6 @@ getFeed addunlockedmatcher opts cache url = do
, void $ feedProblem url
"problem downloading some item(s) from feed"
)
sanitizetitle c
| isControl c = '_'
| otherwise = c
debugfeedcontent tmpf msg = do
feedcontent <- liftIO $ readFile tmpf
fastDebug "Command.ImportFeed" $ unlines