diff --git a/django/core/files/uploadedfile.py b/django/core/files/uploadedfile.py
index 39b99ff..8341ade 100644
a
|
b
|
class UploadedFile(File):
|
39 | 39 | def _set_name(self, name): |
40 | 40 | # Sanitize the file name so that it can't be dangerous. |
41 | 41 | if name is not None: |
42 | | # Just use the basename of the file -- anything else is dangerous. |
43 | | name = os.path.basename(name) |
44 | | |
| 42 | # Just use the basename of the file -- anything else is dangerous. If ends with backslash replaces it with "0" to prevent empty string name. |
| 43 | if name[-1] != "\\": |
| 44 | name = os.path.basename(name) |
| 45 | else: |
| 46 | name = name[:-1] + "0" |
| 47 | name = os.path.basename(name) |
45 | 48 | # File names longer than 255 characters can cause problems on older OSes. |
46 | 49 | if len(name) > 255: |
47 | 50 | name, ext = os.path.splitext(name) |
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 070874f..509e8ec 100644
a
|
b
|
class MultiPartParser(object):
|
173 | 173 | if not file_name: |
174 | 174 | continue |
175 | 175 | file_name = force_text(file_name, encoding, errors='replace') |
176 | | file_name = self.IE_sanitize(unescape_entities(file_name)) |
| 176 | file_name = unescape_entities(file_name) |
177 | 177 | |
178 | 178 | content_type = meta_data.get('content-type', ('',))[0].strip() |
179 | 179 | try: |