[Timob 15594] (3_3_x): Backport of base64 encoding failing on large files

Testing steps in JIRA