From 0fffe918c1505f70238f12c415c223fc3a49b6fc Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Tue, 28 Sep 2021 14:46:19 -0400 Subject: [PATCH] (core) don't garble document url in SELF_HYPERLINK on forks Summary: There was a bad regex processing the document url passed to the sandbox. Test Plan: added test Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D3048 --- app/server/lib/NSandbox.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/server/lib/NSandbox.ts b/app/server/lib/NSandbox.ts index 6e4d1acc..52435f81 100644 --- a/app/server/lib/NSandbox.ts +++ b/app/server/lib/NSandbox.ts @@ -582,9 +582,9 @@ function docker(options: ISandboxOptions): ChildProcess { /** * Collect environment variables that should end up set within the sandbox. */ -function getInsertedEnv(options: ISandboxOptions) { +export function getInsertedEnv(options: ISandboxOptions) { const env: NodeJS.ProcessEnv = { - DOC_URL: (options.docUrl || '').replace(/[^-a-zA-Z0-9_:/?&.]/, ''), + DOC_URL: (options.docUrl || '').replace(/[^-a-zA-Z0-9_:/?&.~]/g, ''), // use stdin/stdout/stderr only. PIPE_MODE: options.minimalPipeMode ? 'minimal' : 'classic',