Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7be5f0ed3d | ||
|
|
938d2b5923 | ||
|
|
13630a79ad |
@@ -1,3 +1,12 @@
|
||||
Version 21.3.1
|
||||
--------------
|
||||
|
||||
Bugfixes
|
||||
********
|
||||
|
||||
* `#2076 <https://github.com/sanic-org/sanic/pull/2076>`_
|
||||
Static files inside subfolders are not accessible (404)
|
||||
|
||||
Version 21.3.0
|
||||
--------------
|
||||
|
||||
|
||||
BIN
examples/static/favicon.ico
Normal file
BIN
examples/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
examples/static/images/logo.png
Normal file
BIN
examples/static/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
2
examples/static/robots.txt
Normal file
2
examples/static/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
6
examples/static_assets.py
Normal file
6
examples/static_assets.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from sanic import Sanic
|
||||
|
||||
|
||||
app = Sanic(__name__)
|
||||
|
||||
app.static("/", "./static")
|
||||
@@ -1 +1 @@
|
||||
__version__ = "21.3.0"
|
||||
__version__ = "21.3.1"
|
||||
|
||||
@@ -776,7 +776,7 @@ class RouteMixin:
|
||||
# If we're not trying to match a file directly,
|
||||
# serve from the folder
|
||||
if not path.isfile(file_or_directory):
|
||||
uri += "/<__file_uri__>"
|
||||
uri += "/<__file_uri__:path>"
|
||||
|
||||
# special prefix for static files
|
||||
# if not static.name.startswith("_static_"):
|
||||
|
||||
4
setup.py
4
setup.py
@@ -8,7 +8,7 @@ import sys
|
||||
|
||||
from distutils.util import strtobool
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools import find_packages, setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ with open_local(["README.rst"]) as rm:
|
||||
setup_kwargs = {
|
||||
"name": "sanic",
|
||||
"version": version,
|
||||
"url": "http://github.com/huge-success/sanic/",
|
||||
"url": "http://github.com/sanic-org/sanic/",
|
||||
"license": "MIT",
|
||||
"author": "Sanic Community",
|
||||
"author_email": "admhpkns@gmail.com",
|
||||
|
||||
1
tests/static/nested/dir/foo.txt
Normal file
1
tests/static/nested/dir/foo.txt
Normal file
@@ -0,0 +1 @@
|
||||
foo
|
||||
@@ -445,3 +445,12 @@ def test_static_name(app, static_file_directory, static_name, file_name):
|
||||
request, response = app.test_client.get(f"/static/{file_name}")
|
||||
|
||||
assert response.status == 200
|
||||
|
||||
|
||||
def test_nested_dir(app, static_file_directory):
|
||||
app.static("/static", static_file_directory)
|
||||
|
||||
request, response = app.test_client.get("/static/nested/dir/foo.txt")
|
||||
|
||||
assert response.status == 200
|
||||
assert response.text == "foo\n"
|
||||
|
||||
Reference in New Issue
Block a user