From 3e81d7e9cb00932e5e486c84888b0bbbc5cf02d4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 7 Mar 2023 10:44:53 +0100 Subject: [PATCH] fix: replace . & .. & $PWD with ~ --- apps/api/src/lib/buildPacks/compose.ts | 5 +++-- apps/ui/src/routes/applications/[id]/storages.svelte | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/api/src/lib/buildPacks/compose.ts b/apps/api/src/lib/buildPacks/compose.ts index 2d16c1f8d..70a2ba8af 100644 --- a/apps/api/src/lib/buildPacks/compose.ts +++ b/apps/api/src/lib/buildPacks/compose.ts @@ -82,9 +82,10 @@ export default async function (data) { v.startsWith('.') || v.startsWith('..') || v.startsWith('/') || - v.startsWith('~') + v.startsWith('~') || + v.startsWith('$PWD') ) { - // Nothing to do here, host path + v = v.replace('$.', `~`).replace('$..', '~').replace('$$PWD', '~'); } else { if (!path) { path = v; diff --git a/apps/ui/src/routes/applications/[id]/storages.svelte b/apps/ui/src/routes/applications/[id]/storages.svelte index 7f16645a2..8a810b635 100644 --- a/apps/ui/src/routes/applications/[id]/storages.svelte +++ b/apps/ui/src/routes/applications/[id]/storages.svelte @@ -40,9 +40,10 @@ volume.startsWith('.') || volume.startsWith('..') || volume.startsWith('/') || - volume.startsWith('~') + volume.startsWith('~') || + volume.startsWith('$PWD') ) { - // Nothing to do here, host path + volume = volume.replace('$.', `~`).replace('$..', '~').replace('$$PWD', '~'); } else { if (!target) { target = volume;