summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2014-11-03 17:57:19 +0000
committerEric Wieser <wieser.eric@gmail.com>2014-12-27 14:48:13 +0000
commit985f9c5376387c2273340ea9e325e5b9a0c1b473 (patch)
treed5b22455b2171a654ff4797e955e71789ed7757e
parent2201e071dc6e2700ad0151fa87c6f0c8ce3cec6f (diff)
downloadbottle-985f9c5376387c2273340ea9e325e5b9a0c1b473.tar.gz
Make `root='/'` work cross-platform
If `root` already ends in `os.sep`, don't add another one. `abspath` strips trailing slashes from all paths _except_ root (C:\, /)
-rw-r--r--bottle.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bottle.py b/bottle.py
index f6add8a..4787e08 100644
--- a/bottle.py
+++ b/bottle.py
@@ -2352,7 +2352,7 @@ def static_file(filename, root, mimetype='auto', download=False, charset='UTF-8'
mime-type. (default: UTF-8)
"""
- root = os.path.abspath(root) + os.sep
+ root = os.path.join(os.path.abspath(root), '')
filename = os.path.abspath(os.path.join(root, filename.strip('/\\')))
headers = dict()