]> git.plutz.net Git - shellwiki/blobdiff - multipart.sh
prevent spamming error log
[shellwiki] / multipart.sh
old mode 100644 (file)
new mode 100755 (executable)
index 09e3ca8..7c0d5dd
@@ -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