Fixed #12397 -- allow safe_join to work with the root file system path, which means you can have your root template or file upload path at this location. You almost certainly don't want to do this, except in *very* limited sandboxed situations.

This commit is contained in:
Alex Gaynor 2012-09-07 16:49:22 -04:00
parent 3a10bcc917
commit b865009d41
3 changed files with 32 additions and 7 deletions

View file

@ -0,0 +1,21 @@
from django.utils import unittest
from django.utils._os import safe_join
class SafeJoinTests(unittest.TestCase):
def test_base_path_ends_with_sep(self):
self.assertEqual(
safe_join("/abc/", "abc"),
"/abc/abc",
)
def test_root_path(self):
self.assertEqual(
safe_join("/", "path"),
"/path",
)
self.assertEqual(
safe_join("/", ""),
"/",
)

View file

@ -21,6 +21,7 @@ from .http import TestUtilsHttp
from .ipv6 import TestUtilsIPv6
from .jslex import JsToCForGettextTest, JsTokensTest
from .module_loading import CustomLoader, DefaultLoader, EggLoader
from .os_utils import SafeJoinTests
from .regex_helper import NormalizeTests
from .simplelazyobject import TestUtilsSimpleLazyObject
from .termcolors import TermColorTests