fix(route/2048): update target URL to ensure proper redirection#21064
fix(route/2048): update target URL to ensure proper redirection#21064TonyRL merged 1 commit intoDIYgod:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request updates the URL handling in the 2048 route to properly resolve relative URLs by using the new URL() constructor with a base URL parameter. The change addresses an issue where the targetUrl extracted from an onclick attribute might be relative and needs to be resolved against the base URL https://2048.info.
Changes:
- Modified line 75 to use
new URL(targetUrl, 'https://2048.info').hrefinstead of directly returningtargetUrl
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const targetUrl = onclickValue?.match(/window\.open\('([^']+)'/)?.[1]; | ||
|
|
||
| return { url: targetUrl }; | ||
| return { url: new URL(targetUrl, 'https://2048.info').href }; |
There was a problem hiding this comment.
The targetUrl variable can be undefined if the regex match fails (line 73 uses optional chaining). Passing undefined to the URL constructor will throw a TypeError. Consider adding a null/undefined check before constructing the URL, or providing a fallback value.
|
Successfully generated as following: http://localhost:1200/2048/2 - Success ✔️<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>新片速递 - 2048核基地</title>
<link>https://qav6.php7plus.com/thread.php?fid-2.html</link>
<atom:link href="http://localhost:1200/2048/2" rel="self" type="application/rss+xml"></atom:link>
<description>新片速递 - 2048核基地 - Powered by RSSHub</description>
<generator>RSSHub</generator>
<webMaster>contact@rsshub.app (RSSHub)</webMaster>
<language>en</language>
<lastBuildDate>Wed, 04 Feb 2026 10:08:12 GMT</lastBuildDate>
<ttl>5</ttl>
<item>
<title>在线影片超百万 原档下载 同步更新 高速播放 合集播放</title>
<description><a href="https://qav6.php7plus.com/yy.php" target="_blank" style="outline: none; text-decoration-line: none; color: rgb(0, 112, 175); font-family: Arial; font-size: 17px; background-color: rgb(245, 250, 254);">☛ 在线看片~</a><div><br><a href="https://qav6.php7plus.com/yy.php" target="_blank" style="outline: none; text-decoration-line: none; color: rgb(0, 112, 175); font-family: Arial; font-size: 17px; background-color: rgb(245, 250, 254);">☛ 在线看片~</a></div><div><br><a href="https://qav6.php7plus.com/yy.php" target="_blank" style="outline: none; text-decoration-line: none; color: rgb(0, 112, 175); font-family: Arial; font-size: 17px; background-color: rgb(245, 250, 254);">☛ 在线看片~</a></div><!--<div style="margin: 10px 0px -20px 0px;color:#d4237a;border:1px dashed;display:flex;width: fit-content;" class="blockquote">-->
<!-- <div><img style="width:20px;" src="images/notice11.png" border="0"></div>-->
<!-- <b>购买本帖会留有购买记录,为保证资源时效,请勿搬运,发现一律永久禁言,想挑衅的請略過此警告!</b>-->
<!-- <div><img style="width:20px;" src="images/notice11.png" border="0"></div>-->
<!-- </div>-->
</description>
<link>https://qav6.php7plus.com/read.php?tid=14022439</link>
<guid isPermaLink="false">https://hjd2048.com/2048/read.php?tid=14022439</guid>
<pubDate>Mon, 06 May 2024 13:21:00 GMT</pubDate>
<author>匿名</author>
</item>
<item>
<title>我为人人回家指南&pc安卓地址发布器下载</title>
<description><font size="3"><b>想要永远不丢失本站,至少下载一个发布器作为主体,苹果用户请收藏右上角的地址发布页,建议两个一起收藏~<br><br>1.现PC版发布器经过改良更新,可百分百获取最新地址!</b></font><br><font size="3"><b>运行前请关闭流氓软件360~</b></font><br><font size="3"><b>解压密码:2048</b></font><br><font size="3"><b><br></b></font><br><font size="3"><b><font color="#ff0000">牢记2048永久域名 2048.cc 或 hjd2048.com(已墙)</font><br></b></font><br><a href="https://qav6.php7plus.com/2048.zip"><b><font size="5">点此高速下载电脑版发布器</font></b></a>&nbsp;<br><br><br><br><br><br><br><font size="5">请各位发帖员统一更新文宣 谢谢!</font><br><br><br><br><br><!--<div style="margin: 10px 0px -20px 0px;color:#d4237a;border:1px dashed;display:flex;width: fit-content;" class="blockquote">-->
<!-- <div><img style="width:20px;" src="images/notice11.png" border="0"></div>-->
<!-- <b>购买本帖会留有购买记录,为保证资源时效,请勿搬运,发现一律永久禁言,想挑衅的請略過此警告!</b>-->
<!-- <div><img style="width:20px;" src="images/notice11.png" border="0"></div>-->
<!-- </div>-->
</description>
<link>https://qav6.php7plus.com/read.php?tid=13283237</link>
<guid isPermaLink="false">https://hjd2048.com/2048/read.php?tid=13283237</guid>
<pubDate>Thu, 07 Mar 2024 19:49:00 GMT</pubDate>
<author>admin</author>
</item>
<item>
<title>■■■ 來訪者必看的內容 - 使你更快速上手 <隨時更新> ■■■</title>
<description><div class="pw_notice_bar" style="margin:10px 0 14px;padding:12px 16px;background:#efefeb;border:2px dashed #e6a3a3;border-radius:8px;font-size:14px;color:#333;line-height:1.9;box-sizing:border-box;"><span style="&quot;font-weight:700;color:#c0392b;&quot;">提示:</span> 禁止一号多次回复灌水,如发现单一账号在同一帖内连续灌水回复,<strong style="&quot;color:#c0392b;&quot;">杀无赦</strong>。<br><span style="&quot;font-weight:700;color:#555;&quot;">注意:</span> 请尊重分享者的帖子内容,有金币的请多多打赏分享者!</div><font size="5"><span style="color:red "><font size="4">警告︰此社區只適合十八歲或以上人士觀看。內容可能令人反感;不可將此論壇的內容派發、傳閱、出售、出租、交給或借予年齡未滿18歲的人士或將本網站內容向該人士出示、</font></span></font><br><font size="5"><span style="color:red "><font size="4">播放或放映。</font></span></font><br><font size="5"><span style="color:red "><font size="4"></font></span></font><font size="5"><span style="color:red "><font size="4">LEGAL DISCLAIMER WARNING: THIS FORUM CONTAINS MATERIAL WHICH MAY OFFEND AND MAY NOT BE DISTRIBUTED, CIRCULATED, SOLD, HIRED, GIVEN, </font></span></font><br><br><font size="5"><span style="color:red "><font size="4"></font></span></font><font size="5"><span style="color:red "><font size="4">LENT,SHOWN, PLAYED OR PROJECTED TO A PERSON UNDER THE AGE OF 18 YEARS. </font></span></font><br><font size="5"><span style="color:red "><font size="4"><br></font></span></font><font size="5"><span style="color:red "><font face="黑体 "><b><font size="3"><span style="color:deeppink "><font size="4">前言</font></span><font size="4"><br><br>歡迎來到2048核基地, 您在本論壇可以言論自由, 但是不能觸及美國法律, 違者屏蔽IP處理<br><br>在本論壇註冊後, 您將享有發帖以及回帖的權限, 當您有資源打算分享時, 我們十分歡迎您的發佈! 但嚴禁發佈幼交和獸交的片子<br><br><span style="color:deeppink ">升級<br><br></span>升級點數 = 威望*1 + 貢獻值*0.02<br><br>威望: 發佈一個帖子威望+1, 回復10個帖子威望+1<br><br>貢獻值: 請查看個人&lt;控制面板&gt;&lt;查看個人資料&gt; <br><br>由上述計算公式看出, 要想儘快提升等級, 發佈主題是最快速的, 等級高了權限和地位也就高了<br><br><span style="color:deeppink ">發佈資源<br><br></span>圖片上傳空間:<br><br><a href="https://img.y7mn.com/" target="_blank">https://img.y7mn.com</a><br><br><br>種子上傳空間:<br><br><br><a href="https://data.elsbbus.com/" target="_blank">https://data.elsbbus.com</a><br><br><span style="color:deeppink ">其他</span><br><br>1)如果您一時無法訪問社區, 請不要著急, 也許服務器上出現了技術故障, 一會就會自動恢復. 當確實無法訪問了, 請在地址發佈器或文宣內查看最<br><br>新地址或收藏最新地址發佈頁<br><br>2)站務聯繫:hjd2048#gmail.com&nbsp;&nbsp;&nbsp;&nbsp;把#改成@&nbsp;&nbsp;Replace # to @<br><br>3)2048核基地從未向用戶收取任何費用用於激活賬號、瀏覽網站,均是完全免費使用。如果您在瀏覽社區時要求付費,則是上了仿冒的2048,請您立刻停止瀏覽。<br><br><span style="color:deeppink ">致中國大陸用戶</span><br><br>2048上發布的資源與信息, 與中國大陸相關法律抵觸, 在您瀏覽本網站時, 請自覺遵守當地法律</font></font></b></font></span></font><!--<div style="margin: 10px 0px -20px 0px;color:#d4237a;border:1px dashed;display:flex;width: fit-content;" class="blockquote">-->
<!-- <div><img style="width:20px;" src="images/notice11.png" border="0"></div>-->
<!-- <b>购买本帖会留有购买记录,为保证资源时效,请勿搬运,发现一律永久禁言,想挑衅的請略過此警告!</b>-->
<!-- <div><img style="width:20px;" src="images/notice11.png" border="0"></div>-->
<!-- </div>-->
</description>
<link>https://qav6.php7plus.com/read.php?tid=4</link>
<guid isPermaLink="false">https://hjd2048.com/2048/read.php?tid=4</guid>
<pubDate>Tue, 20 Mar 2018 15:00:00 GMT</pubDate>
<author>系統消息</author>
</item>
</channel>
</rss> |
Involved Issue / 该 PR 相关 Issue
Close #
Example for the Proposed Route(s) / 路由地址示例
New RSS Route Checklist / 新 RSS 路由检查表
PuppeteerNote / 说明