]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
Replace all escaped slashes in json strings (closes #866)
authorAlexander Sulfrian <asulfrian@zedat.fu-berlin.de>
Fri, 4 Feb 2022 19:34:22 +0000 (20:34 +0100)
committerLukas Schauer <lukas@schauer.dev>
Mon, 31 Oct 2022 15:27:16 +0000 (16:27 +0100)
${var/pattern/string} will only replace the first occurence. We should
use ${var//pattern/string} to replace all escaped slashes.

dehydrated

index 791fe41ee3f1f5a5982684adfcc86875645cbaef..c11d7d0fcabea146949a85e061e942d973c56c0d 100755 (executable)
@@ -217,7 +217,7 @@ jsonsh() {
       '[') parse_array  "$jpath" ;;
       # At this point, the only valid single-character tokens are digits.
       ''|[!0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;;
-      *) value="${token/\\\///}"
+      *) value="${token//\\\///}"
          # replace solidus ("\/") in json strings with normalized value: "/"
          ;;
     esac