qux-bbb / text-utils

vscode extention:Simple Text Utils
GNU General Public License v3.0
2 stars 0 forks source link

Base64 decode does not support padded blocks #3

Closed jakubklos77 closed 3 days ago

jakubklos77 commented 5 days ago

If you have base64 split/padded string then decoding does not work properly. It decodes each line separately.

Lets have an example:

PGgxIHN0eWxlPSJmb250LXNpemU6MTRweCI+PGEgc3R5bGU9ImNvbG9yOiMwMDg4QjUiIGhyZWY9
Imh0dHBzOi8vd3d3LnJvb3QuY3ovenByYXZpY2t5L2ZsaXBwZXItemVyby1kb3N0YWwtcG8tdHJl

most tools (https://www.base64decode.org/) supporting base64 padding will decode the string above as one line: <h1 style="font-size:14px"><a style="color:#0088B5" href="https://www.root.cz/zpravicky/flipper-zero-dostal-po-tre

however, text-utils will decode it as 2 lines:

<h1 style="font-size:14px"><a style="color:#0088B5" href=
"https://www.root.cz/zpravicky/flipper-zero-dostal-po-tre

Please, fix this so we can use the extension easily.

Thank you

qux-bbb commented 5 days ago

At this commit, I specially added "base64 decode multiline"
https://github.com/qux-bbb/text-utils/commit/39b20d2f2b0bb20cd3c6669e41a9549c795fb658
I don't want to remove it, so let me think about it.
Maybe it's good to add an option to switch two modes.

qux-bbb commented 4 days ago

How often do you occur base64 split/padded string?

jakubklos77 commented 4 days ago

How often do you occur base64 split/padded string?

Well, almost every time :). Most of the time all long string encoded base64 is padded (in MIME HTML emails and others).

qux-bbb commented 4 days ago

Then I'll add an option. If you enable it(default), the action will be same like before. If you disable it, the action will decode base64 split/padded string.

jakubklos77 commented 4 days ago

Great, thank you

qux-bbb commented 3 days ago

Added decode_multiline_mode at https://github.com/qux-bbb/text-utils/commit/0021331078810baeee0f8565f42d4eebea09124e
You can update to v1.1.1 and use it.

jakubklos77 commented 3 days ago

Works great, thank you. Good job