snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 45a2aab66cbcb8e6d9286dcbfe19d1a310833061
parent 25ef07b1ec7576becc02bcfc07706184797fea91
Author: Louis Brauer <louis@openbooking.ch>
Date:   Tue, 28 May 2024 02:15:53 +0200

Fix parsing of boundary for multipart/form-data

Diffstat:
Mxs_url.h | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xs_url.h b/xs_url.h @@ -107,7 +107,13 @@ xs_dict *xs_multipart_form_data(const char *payload, int p_size, const char *hea if (xs_list_len(l1) != 2) return NULL; - boundary = xs_fmt("--%s", xs_list_get(l1, 1)); + boundary = xs_dup(xs_list_get(l1, 1)); + + /* Tokodon sends the boundary header with double quotes surrounded */ + if (xs_starts_and_ends("\"", boundary, "\"") != 0) + boundary = xs_strip_chars_i(boundary, "\""); + + boundary = xs_fmt("--%s", boundary); } bsz = strlen(boundary);