fix(p2p): 并集路由先 unquote 再按 @hub 拆名(webui 编码成 %40 导致 offline 骨架屏); pclink.js baseOf/hasPid 兼容 @hub
This commit is contained in:
1 parent
d66509bf09
commit
1438254cda
1 file changed
+4
-3
@@ -19,7 +19,7 @@ from collections import deque
|
||||
from contextlib import suppress
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit
|
||||
from urllib.parse import parse_qsl, quote, unquote, urlencode, urlsplit, urlunsplit
|
||||
|
||||
import websockets
|
||||
try:
|
||||
@@ -1332,8 +1332,9 @@ class HubUnion:
|
||||
if parts.path == "/api/peers":
|
||||
return await self._peers(dict(parse_qsl(parts.query, keep_blank_values=True)).get("psig"))
|
||||
hub = None
|
||||
if len(path) > 3 and path[1] == "api" and "@" in path[2]:
|
||||
path[2], _, hub = path[2].rpartition("@")
|
||||
if len(path) > 3 and path[1] == "api" and "@" in unquote(path[2]): # webui 的 encodeURIComponent 把 @ 编成 %40
|
||||
name, _, hub = unquote(path[2]).rpartition("@")
|
||||
path[2] = quote(name, safe="")
|
||||
target = urlunsplit(("", "", "/".join(path), parts.query, ""))
|
||||
elif body:
|
||||
with suppress(ValueError, AttributeError):
|
||||
|
||||
Reference in new issue
Block a user