Fixed #23397 -- Strip whitespace from base64 during chunking.

This insures the actual base64 content has a length a multiple of 4.
Also add a test case for the failure.