Skip to content

Commit 2a7745c

Browse files
authored
fix: only allow HTTPS URLs to pass through directly in LINE adapter (#5697)
1 parent 82e7502 commit 2a7745c

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

astrbot/core/platform/sources/line/line_event.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async def _component_to_message_object(
104104
@staticmethod
105105
async def _resolve_image_url(segment: Image) -> str:
106106
candidate = (segment.url or segment.file or "").strip()
107-
if candidate.startswith("http://") or candidate.startswith("https://"):
107+
if candidate.startswith("https://"):
108108
return candidate
109109
try:
110110
return await segment.register_to_file_service()
@@ -115,7 +115,7 @@ async def _resolve_image_url(segment: Image) -> str:
115115
@staticmethod
116116
async def _resolve_record_url(segment: Record) -> str:
117117
candidate = (segment.url or segment.file or "").strip()
118-
if candidate.startswith("http://") or candidate.startswith("https://"):
118+
if candidate.startswith("https://"):
119119
return candidate
120120
try:
121121
return await segment.register_to_file_service()
@@ -137,7 +137,7 @@ async def _resolve_record_duration(segment: Record) -> int:
137137
@staticmethod
138138
async def _resolve_video_url(segment: Video) -> str:
139139
candidate = (segment.file or "").strip()
140-
if candidate.startswith("http://") or candidate.startswith("https://"):
140+
if candidate.startswith("https://"):
141141
return candidate
142142
try:
143143
return await segment.register_to_file_service()
@@ -148,9 +148,7 @@ async def _resolve_video_url(segment: Video) -> str:
148148
@staticmethod
149149
async def _resolve_video_preview_url(segment: Video) -> str:
150150
cover_candidate = (segment.cover or "").strip()
151-
if cover_candidate.startswith("http://") or cover_candidate.startswith(
152-
"https://"
153-
):
151+
if cover_candidate.startswith("https://"):
154152
return cover_candidate
155153

156154
if cover_candidate:
@@ -191,7 +189,7 @@ async def _resolve_video_preview_url(segment: Video) -> str:
191189

192190
@staticmethod
193191
async def _resolve_file_url(segment: File) -> str:
194-
if segment.url and segment.url.startswith(("http://", "https://")):
192+
if segment.url and segment.url.startswith("https://"):
195193
return segment.url
196194
try:
197195
return await segment.register_to_file_service()

0 commit comments

Comments
 (0)