]> git.plutz.net Git - shellwiki/blobdiff - multipart.sh
Merge commit 'fb88510e7c955308c1321678f97a8f7d47b92efd'
[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