You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by np...@apache.org on 2021/09/15 17:44:30 UTC

[sling-org-apache-sling-pipes] 04/04: SLING-10817 extend whitespace definition

This is an automated email from the ASF dual-hosted git repository.

npeltier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-pipes.git

commit f2e054bde0654eabc4291a0dd4b9f00997242ed5
Author: Nicolas Peltier <np...@apache.org>
AuthorDate: Wed Sep 15 19:43:48 2021 +0200

    SLING-10817 extend whitespace definition
---
 .../java/org/apache/sling/pipes/internal/CommandExecutorImpl.java  | 2 +-
 .../org/apache/sling/pipes/internal/CommandExecutorImplTest.java   | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/pipes/internal/CommandExecutorImpl.java b/src/main/java/org/apache/sling/pipes/internal/CommandExecutorImpl.java
index 7438989..29c849d 100644
--- a/src/main/java/org/apache/sling/pipes/internal/CommandExecutorImpl.java
+++ b/src/main/java/org/apache/sling/pipes/internal/CommandExecutorImpl.java
@@ -84,7 +84,7 @@ public class CommandExecutorImpl extends AbstractPlumberServlet implements Comma
     static final String REQ_PARAM_HELP = "pipe_help";
     static final String CMD_LINE_PREFIX = "cmd_line_";
     static final String PN_DESCRIPTION = "commandParsed";
-    static final String WHITE_SPACE_SEPARATOR = "\\s";
+    static final String WHITE_SPACE_SEPARATOR = "[\\s\\h]";
     static final String COMMENT_PREFIX = "#";
     static final String SEPARATOR = "|";
     static final String PIPE_SEPARATOR = WHITE_SPACE_SEPARATOR + "*\\" + SEPARATOR + WHITE_SPACE_SEPARATOR + "*";
diff --git a/src/test/java/org/apache/sling/pipes/internal/CommandExecutorImplTest.java b/src/test/java/org/apache/sling/pipes/internal/CommandExecutorImplTest.java
index 31021f1..753e833 100644
--- a/src/test/java/org/apache/sling/pipes/internal/CommandExecutorImplTest.java
+++ b/src/test/java/org/apache/sling/pipes/internal/CommandExecutorImplTest.java
@@ -32,6 +32,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -165,6 +166,12 @@ public class CommandExecutorImplTest extends AbstractPipeTest {
     }
 
     @Test
+    public void testNonBreakingSpaces() throws InvocationTargetException, IllegalAccessException {
+        ExecutionResult result = execute("echo /content | mkdir test @ name child");
+        assertEquals(1, result.size());
+    }
+
+    @Test
     public void adaptToDemoTest() throws Exception {
         String url = "'http://99-bottles-of-beer.net/lyrics.html'";
         String cmd = "egrep " + url + " @ name bottles @ with pattern=(?<number>\\d(\\d)?) | mkdir /var/bottles/${bottles.number}";