about summary refs log tree commit diff
path: root/web/panettone/test/util_test.lisp
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2022-05-28T18·17-0400
committerclbot <clbot@tvl.fyi>2022-05-28T18·30+0000
commit1fbed8e3178c2c2bc2f093374e0035a1fe567377 (patch)
tree72212b2e5ba42339d1ad8e1b77856d6d5d642e7e /web/panettone/test/util_test.lisp
parentb39ca017c0453c7420da64d062a2aa00e27d1fd3 (diff)
fix(web/panettone): Don't add extra padding when already padded r/4182
Because of math being upsetting, we were adding 4 padding characters to
an already-properly-padded base64 string, which broke tazjin.

This also breaks this function out into panettone.util, and adds a test
for it.

Change-Id: I7bc8a440ad9d0917272dd9f2e341081ea14693da
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5782
Autosubmit: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'web/panettone/test/util_test.lisp')
-rw-r--r--web/panettone/test/util_test.lisp9
1 files changed, 9 insertions, 0 deletions
diff --git a/web/panettone/test/util_test.lisp b/web/panettone/test/util_test.lisp
new file mode 100644
index 000000000000..ff52d916cb3a
--- /dev/null
+++ b/web/panettone/test/util_test.lisp
@@ -0,0 +1,9 @@
+(in-package :panettone.tests)
+(declaim (optimize (safety 3)))
+
+(test add-missing-base64-padding-test
+  (is (string=
+       "abcdef"
+       (base64:base64-string-to-string
+        (panettone.util:add-missing-base64-padding
+         "YWJjZGVm")))))