Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Address bot comments

Carlos Monastyrskib688d2210422
diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncPostSyncCommandFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncPostSyncCommandFields.tsx
index 49e4076bf9..abfa732218 100644
--- a/frontend/src/components/pki-syncs/forms/PkiSyncPostSyncCommandFields.tsx
+++ b/frontend/src/components/pki-syncs/forms/PkiSyncPostSyncCommandFields.tsx
@@ -18,8 +18,8 @@ import {
} from "@app/helpers/pkiSyncs";
import { PkiSync, PkiSyncExportFormat, PostSyncCommandVariable } from "@app/hooks/api/pkiSyncs";
-import { PostSyncCommandInput } from "./PostSyncCommandInput";
import { TPkiSyncForm } from "./schemas/pki-sync-schema";
+import { PostSyncCommandInput } from "./PostSyncCommandInput";
const COMMAND_PLACEHOLDERS: Partial<Record<PkiSync, string>> = {
[PkiSync.LinuxServer]: "cp {{certificatePath}} /etc/nginx/ssl/live.pem && systemctl reload nginx",
diff --git a/frontend/src/components/pki-syncs/forms/PostSyncCommandInput.tsx b/frontend/src/components/pki-syncs/forms/PostSyncCommandInput.tsx
index 7397a2d7f5..178e5f75ca 100644
--- a/frontend/src/components/pki-syncs/forms/PostSyncCommandInput.tsx
+++ b/frontend/src/components/pki-syncs/forms/PostSyncCommandInput.tsx
@@ -8,6 +8,8 @@ import { PostSyncCommandVariable } from "@app/hooks/api/pkiSyncs";
const OPEN_VARIABLE_PATTERN = /\{\{([a-zA-Z0-9_]*)$/;
+const TRAILING_VARIABLE_PATTERN = /^[a-zA-Z0-9_]*(\}\})?/;
+
type Props = {
id: string;
value: string;
@@ -60,9 +62,9 @@ export const PostSyncCommandInput = ({
const insertVariable = (variable: PostSyncCommandVariable) => {
if (variableStart === -1) return;
- const hasClosingBraces = value.slice(cursor, cursor + 2) === "}}";
const before = value.slice(0, variableStart);
- const after = value.slice(hasClosingBraces ? cursor + 2 : cursor);
+ const trailing = TRAILING_VARIABLE_PATTERN.exec(value.slice(cursor))?.[0] ?? "";
+ const after = value.slice(cursor + trailing.length);
const caret = before.length + variable.length + 2;
onChange(`${before}${variable}}}${after}`);