babbage icon indicating copy to clipboard operation
babbage copied to clipboard

Base64 encoder shouldn't trim the input

Open mahmoudmohsen213 opened this issue 5 years ago • 1 comments

The base64 encoding plugin disregard any leading or trailing new line characters, which may be important in the original input, for example, encoding chunks of a csv file, where a new line character denotes the end of a record.

If it happened that the end of a chunk aligned with the end of a record (a new line character), it will be removed in the encoding, producing a corrupted file when decoded back.

Example input 01:

str01
str02
str03

Expected and actual: c3RyMDEKc3RyMDIKc3RyMDM=

Example input 02:



str01
str02
str03

Expected: CgpzdHIwMQpzdHIwMgpzdHIwMw== Actual: c3RyMDEKc3RyMDIKc3RyMDM=

Example input 03:

str01
str02
str03


Expected: c3RyMDEKc3RyMDIKc3RyMDMKCg== Actual: c3RyMDEKc3RyMDIKc3RyMDM=

mahmoudmohsen213 avatar Mar 13 '20 02:03 mahmoudmohsen213

hi @mahmoudmohsen213 thanks for reporting this! also sorry for my delay. good catch. ive been (slowly) migrating to a modern version of angular and moving to golang from python., it looks like this issue has been resolved in the newer version @ https://babbage.codes

image

unfortunately that newer version is missing a few other features like file download, upload and a few other things. hopefully that works for you but let me know if those features are really important to you

tomscript avatar Apr 18 '20 16:04 tomscript