mirror of
				https://github.com/django/django.git
				synced 2025-10-30 17:16:10 +00:00 
			
		
		
		
	Fixed #19036 -- Fixed base64 uploads decoding
Thanks anthony at adsorbtion.org for the report, and johannesl for bringing the patch up-to-date.
This commit is contained in:
		| @@ -199,6 +199,12 @@ class MultiPartParser(object): | ||||
|                         for chunk in field_stream: | ||||
|                             if transfer_encoding == 'base64': | ||||
|                                 # We only special-case base64 transfer encoding | ||||
|                                 # We should always read base64 streams by multiple of 4 | ||||
|                                 over_bytes = len(chunk) % 4 | ||||
|                                 if over_bytes: | ||||
|                                     over_chunk = field_stream.read(4 - over_bytes) | ||||
|                                     chunk += over_chunk | ||||
|  | ||||
|                                 try: | ||||
|                                     chunk = base64.b64decode(chunk) | ||||
|                                 except Exception as e: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user