Skip to content

Commit

Permalink
refactor(url): 将 SAFE_WORD 移至 URLUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
Akimio521 committed Dec 5, 2024
1 parent ea23d4e commit a25b0aa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion app/extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
NFO_EXTS,
)
from app.extensions.logo import LOGO
from app.extensions.url import SAFE_WORD
1 change: 0 additions & 1 deletion app/extensions/url/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions app/extensions/url/safeword.py

This file was deleted.

12 changes: 6 additions & 6 deletions app/utils/url.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from urllib.parse import quote, urlparse

from app.extensions import SAFE_WORD


class URLUtils:
"""
URL 相关工具
"""

@staticmethod
def encode(url: str) -> str:
SAFE_WORD = ";/?:@=&"

@classmethod
def encode(cls, url: str) -> str:
"""
URL编码
URL 编码
"""
return quote(url, safe=SAFE_WORD)
return quote(url, safe=cls.SAFE_WORD)

@staticmethod
def get_resolve_url(url: str) -> tuple[str, str, int]:
Expand Down

0 comments on commit a25b0aa

Please sign in to comment.