Skip to content

Commit 1ff7112

Browse files
authored
Merge pull request #84 from leozqin/fix-unretrievable
Fix unretrievable
2 parents 6423ed7 + 9677faa commit 1ff7112

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

app/handlers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def get_content(
4949
url=entry.url,
5050
content=content,
5151
summary=markdown(summary) if summary else None,
52-
unretrievable=True if content else False,
52+
unretrievable=False if content else True,
5353
)
5454

5555
except Exception as e:

app/notification/slack.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@ class SlackNotificationHandler(NotificationHandler):
1616
channel_name: str
1717
routing: Mapping[str, str] = {}
1818

19+
@staticmethod
20+
def _escape_title(title: str) -> str:
21+
translation_table = {"&": "&amp;", "<": "&lt;", ">": "&gt;"}
22+
23+
# Iterate over the string and replace characters if needed
24+
return "".join(translation_table.get(c, c) for c in title)
25+
1926
async def send_notification(self, feed: Feed, entry: FeedEntry):
2027
client = AsyncWebClient(token=self.token)
28+
title = self._escape_title(entry.title)
2129

22-
msg = f"{feed.name}: <{self.make_read_link(entry)}|{entry.title}>"
30+
msg = f"{feed.name}: <{self.make_read_link(entry)}|{title}>"
2331

2432
if feed.notify_destination:
2533
channel = self.routing.get(feed.notify_destination, self.channel_name)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55

66
[project]
77
name = "precis"
8-
version = "0.3.5"
8+
version = "0.3.6"
99
description = "A framework for automating your media diet"
1010
requires-python = ">=3.11"
1111
license = {file = "LICENSE"}

0 commit comments

Comments
 (0)