feat(metadata): enhance metadata handling by sanitizing extracted data and updating documentation for file storage

This commit is contained in:
2026-03-30 23:14:08 +02:00
parent 72b4f7ce3d
commit e6f00ce636
11 changed files with 108 additions and 17 deletions

View File

@@ -0,0 +1,28 @@
package tools
import "testing"
func TestDecodeBase64AcceptsWhitespaceAndMultipleVariants(t *testing.T) {
tests := []struct {
name string
input string
want string
}{
{name: "standard with whitespace", input: "aG V s\nbG8=", want: "hello"},
{name: "raw standard", input: "aGVsbG8", want: "hello"},
{name: "standard url-safe payload", input: "--8=", want: string([]byte{0xfb, 0xef})},
{name: "raw url-safe payload", input: "--8", want: string([]byte{0xfb, 0xef})},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
got, err := decodeBase64(tc.input)
if err != nil {
t.Fatalf("decodeBase64(%q) error = %v", tc.input, err)
}
if string(got) != tc.want {
t.Fatalf("decodeBase64(%q) = %q, want %q", tc.input, string(got), tc.want)
}
})
}
}