fix: use new command for registry updates

This commit is contained in:
Leonhard Breuer
2025-09-03 19:59:17 +02:00
parent 4ca05414af
commit 02215d4e21
+6 -6
View File
@@ -10,15 +10,15 @@ import { IS_CLOUD } from "../constants";
export type Registry = typeof registry.$inferSelect; export type Registry = typeof registry.$inferSelect;
function shQ(s: string): string { function shEscape(s: string | undefined): string {
if (!s) return "''"; if (!s) return "''";
return `'${s.replace(/'/g, `'\\''`)}'`; return `'${s.replace(/'/g, `'\\''`)}'`;
} }
function safeDockerLoginCommand(registry: string, user: string, pass: string) { function safeDockerLoginCommand(registry: string | undefined, user: string | undefined, pass: string | undefined) {
const escapedRegistry = shQ(registry) const escapedRegistry = shEscape(registry)
const escapedUser = shQ(user) const escapedUser = shEscape(user)
const escapedPassword = shQ(pass) const escapedPassword = shEscape(pass)
return `echo ${escapedPassword} | docker login ${escapedRegistry} -u ${escapedUser} --password-stdin`; return `echo ${escapedPassword} | docker login ${escapedRegistry} -u ${escapedUser} --password-stdin`;
} }
@@ -103,7 +103,7 @@ export const updateRegistry = async (
.returning() .returning()
.then((res) => res[0]); .then((res) => res[0]);
const loginCommand = `echo ${response?.password} | docker login ${response?.registryUrl} --username ${response?.username} --password-stdin`; const loginCommand = safeDockerLoginCommand(response?.registryUrl, response?.username, response?.password)
if ( if (
IS_CLOUD && IS_CLOUD &&