From 985f9c5376387c2273340ea9e325e5b9a0c1b473 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 3 Nov 2014 17:57:19 +0000 Subject: 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:\, /) --- bottle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() -- cgit v1.2.1