Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Space in repo names

Andras Bacsai17d56aa972e2
diff --git a/src/app.d.ts b/src/app.d.ts
index 2ebfc021b9..0557299b92 100644
--- a/src/app.d.ts
+++ b/src/app.d.ts
@@ -13,6 +13,8 @@ declare namespace App {
isRunning: boolean;
appId: string;
readOnly: boolean;
+ source: string;
+ settings: string;
}
}
diff --git a/src/lib/common.ts b/src/lib/common.ts
index 996ec4750b..c7f229b0e1 100644
--- a/src/lib/common.ts
+++ b/src/lib/common.ts
@@ -2,7 +2,8 @@ import child from 'child_process';
import util from 'util';
import { dev } from '$app/env';
import * as Sentry from '@sentry/node';
-import { uniqueNamesGenerator, Config, adjectives, colors, animals } from 'unique-names-generator';
+import { uniqueNamesGenerator, adjectives, colors, animals } from 'unique-names-generator';
+import type { Config } from 'unique-names-generator';
import * as db from '$lib/database';
import { buildLogQueue } from './queues';
@@ -107,11 +108,6 @@ export function getEngine(engine) {
return engine === '/var/run/docker.sock' ? 'unix:///var/run/docker.sock' : engine;
}
-// export async function saveSshKey(destination) {
-// return await asyncExecShell(
-// `echo '${destination.sshPrivateKey}' > /tmp/id_rsa_${destination.id} && chmod 600 /tmp/id_rsa_${destination.id}`
-// );
-// }
export async function removeContainer(id, engine) {
const host = getEngine(engine);
try {
@@ -133,8 +129,9 @@ export const removeDestinationDocker = async ({ id, engine }) => {
};
export const createDirectories = async ({ repository, buildId }) => {
- const repodir = `/tmp/build-sources/${repository}/`;
- const workdir = `/tmp/build-sources/${repository}/${buildId}`;
+ const dashedRepository = dashify(repository);
+ const repodir = `/tmp/build-sources/${dashedRepository}/`;
+ const workdir = `/tmp/build-sources/${dashedRepository}/${buildId}`;
await asyncExecShell(`mkdir -p ${workdir}`);
@@ -151,3 +148,13 @@ export function generateTimestamp() {
export function getDomain(domain) {
return domain?.replace('https://', '').replace('http://', '');
}
+
+export function dashify(str: string, options?: any): string {
+ if (typeof str !== 'string') return str;
+ return str
+ .trim()
+ .replace(/\W/g, (m) => (/[À-ž]/.test(m) ? m : '-'))
+ .replace(/^-+|-+$/g, '')
+ .replace(/-{2,}/g, (m) => (options && options.condense ? '-' : m))
+ .toLowerCase();
+}
diff --git a/src/lib/components/common.ts b/src/lib/components/common.ts
index 8903385978..b9b3ac982b 100644
--- a/src/lib/components/common.ts
+++ b/src/lib/components/common.ts
@@ -27,3 +27,13 @@ export function getDomain(domain) {
export function generateRemoteEngine(destination) {
return `ssh://${destination.user}@${destination.ipAddress}:${destination.port}`;
}
+
+export function dashify(str: string, options?: any): string {
+ if (typeof str !== 'string') return str;
+ return str
+ .trim()
+ .replace(/\W/g, (m) => (/[À-ž]/.test(m) ? m : '-'))
+ .replace(/^-+|-+$/g, '')
+ .replace(/-{2,}/g, (m) => (options && options.condense ? '-' : m))
+ .toLowerCase();
+}
diff --git a/src/lib/github.ts b/src/lib/github.ts
deleted file mode 100644
index 0fb68ea0a1..0000000000
--- a/src/lib/github.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export function dashify(str: string, options?: any): string {
- if (typeof str !== 'string') return str;
- return str
- .trim()
- .replace(/\W/g, (m) => (/[À-ž]/.test(m) ? m : '-'))
- .replace(/^-+|-+$/g, '')
- .replace(/-{2,}/g, (m) => (options && options.condense ? '-' : m))
- .toLowerCase();
-}
diff --git a/src/routes/sources/[id]/newGithubApp.svelte b/src/routes/sources/[id]/newGithubApp.svelte
index 80139acc23..c8cb4f6f38 100644
--- a/src/routes/sources/[id]/newGithubApp.svelte
+++ b/src/routes/sources/[id]/newGithubApp.svelte
@@ -30,8 +30,7 @@
<script>
import { dev } from '$app/env';
- import { getDomain } from '$lib/components/common';
- import { dashify } from '$lib/github';
+ import { getDomain, dashify } from '$lib/components/common';
export let source;
export let settings;