fix: URL-decode channel_id path params, strip @ prefix for state lookup
This commit is contained in:
+3
-2
@@ -1830,7 +1830,7 @@ class TelegramScraperRequestHandler(BaseHTTPRequestHandler):
|
||||
return self.send_json(list_channels_snapshot())
|
||||
if path.startswith("/api/channels/") and path.endswith("/messages"):
|
||||
parts = path.split("/")
|
||||
channel_id = parts[3]
|
||||
channel_id = urllib.parse.unquote(parts[3]).lstrip("@")
|
||||
limit = max(1, min(int(query.get("limit", ["120"])[0]), 300))
|
||||
before = query.get("before")
|
||||
before_message_id = int(before[0]) if before else None
|
||||
@@ -1919,7 +1919,7 @@ class TelegramScraperRequestHandler(BaseHTTPRequestHandler):
|
||||
if sub == ["channels"]:
|
||||
return self._handle_get_account_channels(account_id)
|
||||
if len(sub) >= 3 and sub[0] == "channels" and sub[-1] == "messages":
|
||||
channel_id = sub[1]
|
||||
channel_id = urllib.parse.unquote(sub[1]).lstrip("@")
|
||||
return self._handle_get_account_channel_messages(account_id, channel_id, query)
|
||||
if sub == ["continuous"]:
|
||||
return self.send_json(
|
||||
@@ -2409,6 +2409,7 @@ class TelegramScraperRequestHandler(BaseHTTPRequestHandler):
|
||||
return self.send_json(payload)
|
||||
|
||||
def _handle_account_channel_add(self, account_id: str, channel_id: str, name: Optional[str]) -> None:
|
||||
channel_id = channel_id.lstrip("@")
|
||||
if not channel_id:
|
||||
return self.send_error_json(HTTPStatus.BAD_REQUEST, "channel_id is required")
|
||||
store = get_account_store(DATA_DIR, account_id)
|
||||
|
||||
Reference in New Issue
Block a user