mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
修复获取link时./开头链接的问题
This commit is contained in:
parent
61dce186c6
commit
a877f646e0
@ -10,7 +10,7 @@ from html import unescape
|
|||||||
from http.cookiejar import Cookie, CookieJar
|
from http.cookiejar import Cookie, CookieJar
|
||||||
from os.path import sep
|
from os.path import sep
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from re import sub, match
|
from re import sub
|
||||||
from urllib.parse import urlparse, urljoin, urlunparse
|
from urllib.parse import urlparse, urljoin, urlunparse
|
||||||
|
|
||||||
from DataRecorder.tools import make_valid_name
|
from DataRecorder.tools import make_valid_name
|
||||||
@ -144,8 +144,11 @@ def make_absolute_link(link, baseURI=None):
|
|||||||
link = link.strip().replace('\\', '/')
|
link = link.strip().replace('\\', '/')
|
||||||
parsed = urlparse(link)._asdict()
|
parsed = urlparse(link)._asdict()
|
||||||
if baseURI:
|
if baseURI:
|
||||||
p = urlparse(baseURI)._asdict()
|
if link.startswith('./'):
|
||||||
baseURI = f'{p["scheme"]}://{p["netloc"]}'
|
baseURI = baseURI[:baseURI.rfind('/') + 1]
|
||||||
|
else:
|
||||||
|
p = urlparse(baseURI)._asdict()
|
||||||
|
baseURI = f'{p["scheme"]}://{p["netloc"]}'
|
||||||
|
|
||||||
# 是相对路径,与页面url拼接并返回
|
# 是相对路径,与页面url拼接并返回
|
||||||
if not parsed['netloc']:
|
if not parsed['netloc']:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user