Skip to content

Commit

Permalink
fixed url checking error
Browse files Browse the repository at this point in the history
  • Loading branch information
zaxtyson committed Jul 22, 2020
1 parent 07eeafd commit c32ae3a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
|bye |退出程序 |

# 更新日志
## `v2.5.3`
- 修复新出现的 URL 包含大写字符无法匹配的问题

## `v2.5.2`
- 修复子域名变化导致的异常
- `share` 命令不再显示文件夹下的文件信息
Expand Down
2 changes: 1 addition & 1 deletion lanzou/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lanzou.api.core import LanZouCloud

version = '2.5.2'
version = '2.5.3'

__all__ = ['utils', 'types', 'models', 'LanZouCloud', 'version']
8 changes: 4 additions & 4 deletions lanzou/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def is_name_valid(filename: str) -> bool:

def is_file_url(share_url: str) -> bool:
"""判断是否为文件的分享链接"""
base_pat = r'https?://.*?\.?lanzou[six].com/.+' # 子域名可个性化设置或者不存在
user_pat = r'https?://.*?\.?lanzou[six].com/i[a-z0-9]{5,}/?' # 普通用户 URL 规则
base_pat = r'https?://[a-zA-Z0-9-]*?\.?lanzou[six].com/.+' # 子域名可个性化设置或者不存在
user_pat = r'https?://[a-zA-Z0-9-]*?\.?lanzou[six].com/i[a-zA-Z0-9]{5,}/?' # 普通用户 URL 规则
if not re.fullmatch(base_pat, share_url):
return False
elif re.fullmatch(user_pat, share_url):
Expand All @@ -91,8 +91,8 @@ def is_file_url(share_url: str) -> bool:

def is_folder_url(share_url: str) -> bool:
"""判断是否为文件夹的分享链接"""
base_pat = r'https?://.*?\.?lanzou[six].com/.+'
user_pat = r'https?://.*?\.?lanzou[six].com/b[a-z0-9]{7,}/?'
base_pat = r'https?://[a-zA-Z0-9-]*?\.?lanzou[six].com/.+'
user_pat = r'https?://[a-zA-Z0-9-]*?\.?lanzou[six].com/i[a-zA-Z0-9]{7,}/?'
if not re.fullmatch(base_pat, share_url):
return False
elif re.fullmatch(user_pat, share_url):
Expand Down
2 changes: 1 addition & 1 deletion lanzou/cmder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lanzou.cmder.config import config

version = '2.5.2'
version = '2.5.3'

__all__ = ['cmder', 'utils', 'version', 'config']

0 comments on commit c32ae3a

Please sign in to comment.