mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-27 09:58:31 +07:00
Fix unquote compatibility
This commit is contained in:
@@ -6,9 +6,11 @@ PY2 = int(sys.version[0]) == 2
|
||||
|
||||
if PY2:
|
||||
from urlparse import urljoin, urlparse, urlunparse
|
||||
import urllib
|
||||
urljoin = urljoin
|
||||
urlparse = urlparse
|
||||
urlunparse = urlunparse
|
||||
urlunquote = urllib.unquote
|
||||
|
||||
import SimpleHTTPServer as httpserver
|
||||
httpserver = httpserver
|
||||
@@ -21,10 +23,11 @@ if PY2:
|
||||
unicode = unicode
|
||||
basestring = basestring
|
||||
else: # PY3
|
||||
from urllib.parse import urljoin, urlparse, urlunparse
|
||||
from urllib.parse import urljoin, urlparse, urlunparse, unquote
|
||||
urljoin = urljoin
|
||||
urlparse = urlparse
|
||||
urlunparse = urlunparse
|
||||
urlunquote = unquote
|
||||
|
||||
import http.server as httpserver
|
||||
httpserver = httpserver
|
||||
|
||||
@@ -3,14 +3,13 @@ from __future__ import print_function
|
||||
|
||||
from watchdog import events, observers
|
||||
from mkdocs.build import build
|
||||
from mkdocs.compat import httpserver, socketserver
|
||||
from mkdocs.compat import httpserver, socketserver, urlunquote
|
||||
from mkdocs.config import load_config
|
||||
import os
|
||||
import posixpath
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import urllib
|
||||
|
||||
|
||||
class BuildEventHandler(events.FileSystemEventHandler):
|
||||
@@ -49,7 +48,7 @@ class FixedDirectoryHandler(httpserver.SimpleHTTPRequestHandler):
|
||||
# abandon query parameters
|
||||
path = path.split('?', 1)[0]
|
||||
path = path.split('#', 1)[0]
|
||||
path = posixpath.normpath(urllib.unquote(path))
|
||||
path = posixpath.normpath(urlunquote(path))
|
||||
words = path.split('/')
|
||||
words = filter(None, words)
|
||||
path = self.base_dir
|
||||
|
||||
Reference in New Issue
Block a user