From ff3d82bdaf9ed3ad9bc5919a977e91eba81e848c Mon Sep 17 00:00:00 2001 From: Nguyen Huu Thuong Date: Sat, 13 Jun 2020 09:07:50 +0200 Subject: [PATCH] strip quotes --- .github/workflows/deploy.yml | 2 +- app.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 261ddf4..88a8671 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,7 +37,7 @@ jobs: last_ssh: |- echo $LASTSSH && (mkdir test1/test || true) - || ls -la + ls -la - name: scp ssh pipelines uses: cross-the-world/ssh-scp-ssh-pipelines@latest diff --git a/app.py b/app.py index 5a3f57c..3e2d4ae 100644 --- a/app.py +++ b/app.py @@ -34,6 +34,17 @@ def convert_to_seconds(s): return 30 +strips = ["", "\"", "", "'", ""] + + +def strip_path(p): + if not p: + return None + for c in strips: + p = p.strip(c) + return p + + def connect(callback=None): with paramiko.SSHClient() as ssh: p_key = paramiko.RSAKey.from_private_key(INPUT_KEY) if INPUT_KEY else None @@ -84,8 +95,8 @@ def scp_process(ssh, input_scp): continue l2r = c.split("=>") if len(l2r) == 2: - local = l2r[0].strip() - remote = l2r[1].strip() + local = strip_path(l2r[0]) + remote = strip_path(l2r[1]) if local and remote: copy_list.append({"l": local, "r": remote}) continue