Commit Graph

23 Commits

Author SHA1 Message Date
Aymeric Augustin b8ba73cd0c Raised SuspiciousFileOperation in safe_join.
Added a test for the condition safe_join is designed to prevent.

Previously, a generic ValueError was raised. It was impossible to tell
an intentional exception raised to implement safe_join's contract from
an unintentional exception caused by incorrect inputs or unexpected
conditions. That resulted in bizarre exception catching patterns, which
this patch removes.

Since safe_join is a private API and since the change is unlikely to
create security issues for users who use it anyway -- at worst, an
uncaught SuspiciousFileOperation exception will bubble up -- it isn't
documented.
2014-11-11 19:05:14 +01:00
Claude Paroz 18b3788401 Cleaned temp dir in symlinks_supported()
Refs #21482.
2014-06-23 13:27:52 +02:00
Jannis Leidel 5cc0555603 Fixed #21482 -- Uplifted restriction of collectstatic using symlink option in Windows NT 6.
Original patch by Vajrasky Kok. Reviewed by Florian Apolloner, Aymeric Augustin.
2014-02-09 12:39:20 +00:00
Christopher Medrela 7477a4ffde Fixed E125 pep8 warnings 2013-11-28 08:50:11 -05:00
Ray Ashman Jr e2ae8b048e Correct flake8 E302 violations 2013-11-02 19:53:29 -04:00
Alex Gaynor 7548aa8ffd More attacking E302 violators 2013-11-02 13:12:09 -07:00
Aymeric Augustin 365c3e8b73 Replaced "not PY3" by "PY2", new in six 1.4.0. 2013-09-02 12:11:02 +02:00
Florian Apolloner c9d07d251f Fixed loaddata for Django checkouts with non ASCII chars in the name. 2013-06-03 13:18:16 +02:00
Claude Paroz c91667338a Fixed #19357 -- Allow non-ASCII chars in filesystem paths
Thanks kujiu for the report and Aymeric Augustin for the review.
2012-12-08 11:13:52 +01:00
Alex Gaynor b865009d41 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. 2012-09-07 16:49:22 -04:00
Aymeric Augustin a4abe7ed56 [py3] abspathu doesn't exist under Python 3. 2012-08-08 12:56:12 +02:00
Aymeric Augustin c5ef65bcf3 [py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
  Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
  and smart_bytes under Python 2 (which is backwards compatible).
  Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
  want a str.
2012-08-07 12:00:22 +02:00
Alex Gaynor aa1aa1ad41 Fix a typo in a comment. 2012-04-30 10:15:36 -04:00
Jannis Leidel ad1c376d39 Fixed a missing exception (`WindowsError`) when using the rmtree error handler on non-Windows systems.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17247 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 22:38:10 +00:00
Chris Beaven fcf7fbc68c Fixes #8593 -- better handling of safe_join case sensitivity on windows. Thanks for the initial patch, ramiro.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-22 23:56:42 +00:00
Jannis Leidel ae10b2772b Fixed #15369 -- Added missing import in _os module. Thanks, jonash.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15611 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-21 14:16:29 +00:00
Jannis Leidel d18d37ce29 Added our own rmtree error handler to make sure we can delete correctly delete .svn directories when running the tests on Windows which are read-only for some reason.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15120 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-31 14:22:55 +00:00
Chris Beaven aff9ff9bf5 Fixes #14715 -- More informative ValueError for safe_join util. Thanks btubbs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14699 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-26 02:28:07 +00:00
Karen Tracey dfa90aec1b Fixed #9579 -- Properly handle apps running with (and specifically, loading templates from) a current working directory path that contains non-ASCII characters. Thanks for the report to gonzalodelgado and for advice on how to fix it to Daniel Pope.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-13 19:03:42 +00:00
Malcolm Tredinnick 8fb1459b52 Added some better error reporting and path handling when creating template paths.
We now raise UnicodeDecodeError for non-UTF-8 bytestrings (thanks to Daniel
Pope for diagnosing this was being swallowed by ValueError) and allow UTF-8
bytestrings as template directories.

Refs #8965.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9161 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-06 06:34:54 +00:00
Malcolm Tredinnick f6e86c4286 Fixed #5111 -- Set svn:eol-style to 'native' on files that didn't have it
already.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5876 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-12 12:49:01 +00:00
Adrian Holovaty b263e1704c Changed safe_join() docstring from [5750] to use active verbs. See also [5756]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5758 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-25 03:18:17 +00:00
Gary Wilson Jr 304381616f Fixed #4952 -- Fixed the `get_template_sources` functions of the `app_directories` and `filesystem` template loaders to not return paths outside of given template directories. Both functions now make use of a new `safe_join` utility function. Thanks to SmileyChris for help with the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-23 04:45:01 +00:00