From: Paul Hänsch Date: Mon, 12 Jun 2023 11:38:47 +0000 (+0200) Subject: Bugfix: file uploads got NULL characters converted to Linefeeds when using busybox sed X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=3582e177e2769524b539c08ac1f76024f26a929e;p=shellwiki Bugfix: file uploads got NULL characters converted to Linefeeds when using busybox sed --- diff --git a/multipart.sh b/multipart.sh index 09e3ca8..7c0d5dd 100755 --- a/multipart.sh +++ b/multipart.sh @@ -53,8 +53,9 @@ multipart(){ ;; "${CR}") if [ $state = dheader ]; then - sed -n "/--${multipart_boundary}\(--\)\?${CR}/q; p;" \ - | head -c-2 + # Do not use `sed -n` (or busybox sed will "convert" NULL to LF) + sed "/--${multipart_boundary}\(--\)\?${CR}/{x;q;}" \ + | head -c-3 return 0; fi [ $state = header ] && state=junk