0001-fix-typo-attachement-attachment-fixes-22676.patch
fargo/oauth2/utils.py | ||
---|---|---|
25 | 25 |
return None, 'missing content-disposition header' |
26 | 26 |
content_header = request.META['HTTP_CONTENT_DISPOSITION'] |
27 | 27 |
disposition_type, filename = cgi.parse_header(content_header) |
28 |
if disposition_type != 'attachement':
|
|
29 |
return None, 'wrong disposition type: attachement excpected'
|
|
28 |
if disposition_type != 'attachment': |
|
29 |
return None, 'wrong disposition type: attachment excpected' |
|
30 | 30 |
if 'filename*' in filename: |
31 | 31 |
encode, country, name = filename['filename*'].split("'") |
32 | 32 |
fargo/oauth2/views.py | ||
---|---|---|
143 | 143 | |
144 | 144 |
ascii_filename = doc.filename.encode('ascii', 'replace') |
145 | 145 |
percent_encoded_filename = quote(doc.filename.encode('utf8'), safe='') |
146 |
response['Content-Disposition'] = 'attachement; filename="%s"; filename*=UTF-8\'\'%s' % (ascii_filename,
|
|
146 |
response['Content-Disposition'] = 'attachment; filename="%s"; filename*=UTF-8\'\'%s' % (ascii_filename, |
|
147 | 147 |
percent_encoded_filename) |
148 | 148 |
return response |
149 | 149 |
tests/test_oauth2.py | ||
---|---|---|
107 | 107 |
assert resp.content_type == 'application/octet-stream' |
108 | 108 |
assert 'Content-disposition' in resp.headers |
109 | 109 |
content_disposition = resp.content_disposition.replace(' ', '').split(';') |
110 |
assert content_disposition[0] == 'attachement'
|
|
110 |
assert content_disposition[0] == 'attachment' |
|
111 | 111 |
assert content_disposition[1] == 'filename="Baudelaire.txt"' |
112 | 112 |
assert content_disposition[2] == 'filename*=UTF-8\'\'Baudelaire.txt' |
113 | 113 | |
... | ... | |
127 | 127 |
filename = 'Baudelaire.txt'.encode('ascii', 'replace') |
128 | 128 |
percent_encode_filename = quote(filename.encode('utf8'), safe='') |
129 | 129 |
headers = { |
130 |
'Content-disposition': 'attachement; filename="%s"; filename*=UTF-8\'\'%s' % (filename, percent_encode_filename)
|
|
130 |
'Content-disposition': 'attachment; filename="%s"; filename*=UTF-8\'\'%s' % (filename, percent_encode_filename) |
|
131 | 131 |
} |
132 | 132 | |
133 | 133 |
assert len(OAuth2TempFile.objects.all()) == 0 |
134 |
- |