diff --git a/app/application/security/cookie.py b/app/application/security/cookie.py index 2ffb28495..ab31c027a 100644 --- a/app/application/security/cookie.py +++ b/app/application/security/cookie.py @@ -109,7 +109,7 @@ class CookieHelper: return cookie_str @staticmethod - def _find_login_page_url(html, current_url: str) -> Optional[str]: + def _find_login_page_url(html: etree._Element, current_url: str) -> Optional[str]: """从首页查找同源登录入口,避免把账号密码提交到跨域页面。""" login_hrefs = html.xpath( "//a[" @@ -123,7 +123,7 @@ class CookieHelper: target = urlparse(login_url) if target.scheme in ("http", "https") and \ target.scheme == current.scheme and target.netloc == current.netloc: - return login_url + return str(login_url) return None def get_site_cookie_ua(self, @@ -195,7 +195,7 @@ class CookieHelper: html = etree.HTML(html_text) if html_text else None if html is None: return None, None, "解析网页源码失败" - for xpath in self._SITE_LOGIN_XPATH.get("username"): + for xpath in self._SITE_LOGIN_XPATH["username"]: if html.xpath(xpath): username_xpath = xpath break diff --git a/tests/fixtures/architecture/mypy-baseline.json b/tests/fixtures/architecture/mypy-baseline.json index 46d470b53..02ae0dd14 100644 --- a/tests/fixtures/architecture/mypy-baseline.json +++ b/tests/fixtures/architecture/mypy-baseline.json @@ -67,7 +67,7 @@ "arg-type": 4, "no-any-return": 2, "no-untyped-def": 1, - "operator": 2, + "operator": 1, "type-arg": 8, "union-attr": 5, "var-annotated": 2