mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
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:
21
tests/regressiontests/utils/os_utils.py
Normal file
21
tests/regressiontests/utils/os_utils.py
Normal 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("/", ""),
|
||||
"/",
|
||||
)
|
||||
Reference in New Issue
Block a user