mirror of
https://github.com/django/django.git
synced 2025-10-29 16:46:11 +00:00
Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
This commit is contained in:
@@ -5,20 +5,19 @@ from os.path import abspath, dirname, join, normcase, sep
|
||||
from django.core.exceptions import SuspiciousFileOperation
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
# For backwards-compatibility in Django 2.0
|
||||
abspathu = abspath
|
||||
|
||||
|
||||
def upath(path):
|
||||
"""
|
||||
Always return a unicode path.
|
||||
"""
|
||||
"""Always return a unicode path (did something for Python 2)."""
|
||||
return path
|
||||
|
||||
|
||||
def npath(path):
|
||||
"""
|
||||
Always return a native path, that is unicode on Python 3 and bytestring on
|
||||
Python 2.
|
||||
Python 2. Noop for Python 3.
|
||||
"""
|
||||
return path
|
||||
|
||||
@@ -33,8 +32,8 @@ def safe_join(base, *paths):
|
||||
"""
|
||||
base = force_text(base)
|
||||
paths = [force_text(p) for p in paths]
|
||||
final_path = abspathu(join(base, *paths))
|
||||
base_path = abspathu(base)
|
||||
final_path = abspath(join(base, *paths))
|
||||
base_path = abspath(base)
|
||||
# Ensure final_path starts with base_path (using normcase to ensure we
|
||||
# don't false-negative on case insensitive operating systems like Windows),
|
||||
# further, one of the following conditions must be true:
|
||||
|
||||
Reference in New Issue
Block a user