Fix: the Chinese URI
This commit is contained in:
parent
42cd424274
commit
e34de96b24
|
@ -7,7 +7,7 @@ from collections import deque, defaultdict
|
|||
from functools import partial
|
||||
from inspect import isawaitable, stack, getmodulename
|
||||
from traceback import format_exc
|
||||
from urllib.parse import quote, urlencode, urlunparse
|
||||
from urllib.parse import urlencode, urlunparse
|
||||
from ssl import create_default_context, Purpose
|
||||
|
||||
from sanic.config import Config
|
||||
|
@ -25,6 +25,7 @@ from sanic.websocket import WebSocketProtocol, ConnectionClosed
|
|||
|
||||
|
||||
class Sanic:
|
||||
|
||||
def __init__(self, name=None, router=None, error_handler=None,
|
||||
load_env=True, request_class=None,
|
||||
strict_slashes=False, log_config=None,
|
||||
|
@ -110,11 +111,9 @@ class Sanic:
|
|||
|
||||
:param event: event to listen to
|
||||
"""
|
||||
|
||||
def decorator(listener):
|
||||
self.listeners[event].append(listener)
|
||||
return listener
|
||||
|
||||
return decorator
|
||||
|
||||
# Decorator
|
||||
|
@ -136,7 +135,7 @@ class Sanic:
|
|||
# and will probably get confused as to why it's not working
|
||||
if not uri.startswith('/'):
|
||||
uri = '/' + uri
|
||||
uri = quote(uri)
|
||||
|
||||
if stream:
|
||||
self.is_request_stream = True
|
||||
|
||||
|
@ -429,7 +428,7 @@ class Sanic:
|
|||
uri, route = self.router.find_route_by_view_name(view_name, **kw)
|
||||
if not (uri and route):
|
||||
raise URLBuildError('Endpoint with name `{}` was not found'.format(
|
||||
view_name))
|
||||
view_name))
|
||||
|
||||
if view_name == 'static' or view_name.endswith('.static'):
|
||||
filename = kwargs.pop('filename', None)
|
||||
|
|
|
@ -2,6 +2,7 @@ import re
|
|||
from collections import defaultdict, namedtuple
|
||||
from collections.abc import Iterable
|
||||
from functools import lru_cache
|
||||
from urllib.parse import unquote
|
||||
|
||||
from sanic.exceptions import NotFound, MethodNotSupported
|
||||
from sanic.views import CompositionView
|
||||
|
@ -373,6 +374,7 @@ class Router:
|
|||
:param method: request method
|
||||
:return: handler, arguments, keyword arguments
|
||||
"""
|
||||
# url = unquote(url)
|
||||
url = host + url
|
||||
# Check against known static routes
|
||||
route = self.routes_static.get(url)
|
||||
|
|
Loading…
Reference in New Issue
Block a user