MCPcopy
hub / github.com/django/django / file_upload_unicode_name

Function file_upload_unicode_name

tests/file_uploads/views.py:64–77  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

62
63
64def file_upload_unicode_name(request):
65 # Check to see if Unicode name came through properly.
66 if not request.FILES["file_unicode"].name.endswith(UNICODE_FILENAME):
67 return HttpResponseServerError()
68 # Check to make sure the exotic characters are preserved even
69 # through file save.
70 uni_named_file = request.FILES["file_unicode"]
71 file_model = FileModel.objects.create(testfile=uni_named_file)
72 full_name = f"{UPLOAD_FOLDER}/{uni_named_file.name}"
73 return (
74 HttpResponse()
75 if file_model.testfile.storage.exists(full_name)
76 else HttpResponseServerError()
77 )
78
79
80def file_upload_echo(request):

Callers

nothing calls this directly

Calls 4

HttpResponseClass · 0.90
createMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected