Find URL encoded filenames on the fs by decoding them first
This commit is contained in:
parent
e3453553e1
commit
0464d31a9c
|
@ -2,6 +2,7 @@ from aiofiles.os import stat
|
||||||
from os import path
|
from os import path
|
||||||
from re import sub
|
from re import sub
|
||||||
from time import strftime, gmtime
|
from time import strftime, gmtime
|
||||||
|
from urllib.parse import unquote
|
||||||
|
|
||||||
from .exceptions import FileNotFound, InvalidUsage
|
from .exceptions import FileNotFound, InvalidUsage
|
||||||
from .response import file, HTTPResponse
|
from .response import file, HTTPResponse
|
||||||
|
@ -38,6 +39,8 @@ def register(app, uri, file_or_directory, pattern, use_modified_since):
|
||||||
# from herping a derp and treating the uri as an absolute path
|
# from herping a derp and treating the uri as an absolute path
|
||||||
file_path = path.join(file_or_directory, sub('^[/]*', '', file_uri)) \
|
file_path = path.join(file_or_directory, sub('^[/]*', '', file_uri)) \
|
||||||
if file_uri else file_or_directory
|
if file_uri else file_or_directory
|
||||||
|
|
||||||
|
file_path = unquote(file_path)
|
||||||
try:
|
try:
|
||||||
headers = {}
|
headers = {}
|
||||||
# Check if the client has been sent this file before
|
# Check if the client has been sent this file before
|
||||||
|
|
Loading…
Reference in New Issue
Block a user