Skip to content

Commit c39246c

Browse files
authored
Merge pull request #2367 from appwrite/fix-repo-url
2 parents eeee1f6 + 05e8285 commit c39246c

File tree

7 files changed

+23
-13
lines changed

7 files changed

+23
-13
lines changed

src/lib/helpers/github.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ export function getNestedRootDirectory(repository: string): string | null {
33
return match ? match[1] : null;
44
}
55

6-
export function getRepositoryInfo(repository: string): { owner: string; name: string } | null {
6+
export function getRepositoryInfo(
7+
repository: string
8+
): { owner: string; name: string; url: string } | null {
79
const match = repository
810
.trim()
911
.match(/(?:^|\/\/|@)github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?(?:$|[/?#])/i);
@@ -13,7 +15,9 @@ export function getRepositoryInfo(repository: string): { owner: string; name: st
1315
const owner = decodeURIComponent(match[1]);
1416
const name = decodeURIComponent(match[2].replace(/\.git$/i, ''));
1517

16-
return { owner, name };
18+
const url = `https://github.com/${owner}/${name}`;
19+
20+
return { owner, name, url };
1721
}
1822

1923
export async function getLatestTag(owner: string, name: string): Promise<string | null> {

src/routes/(console)/project-[region]-[project]/functions/create-function/deploy/+page.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,12 @@
270270
href={`${base}/project-${page.params.region}-${page.params.project}/functions`}>
271271
Cancel
272272
</Button>
273-
<Button submit disabled={!name || !runtime || !specification}>
273+
<Button
274+
submit
275+
fullWidthMobile
276+
submissionLoader
277+
forceShowLoader={$isSubmitting}
278+
disabled={!name || !runtime || !specification || $isSubmitting}>
274279
Deploy function
275280
</Button>
276281
</Layout.Stack>

src/routes/(console)/project-[region]-[project]/functions/create-function/deploy/+page.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const load: PageLoad = async ({ url, params, parent }) => {
1313
redirect(302, `${base}/project-${params.region}-${params.project}/functions`);
1414
}
1515

16-
const info = getRepositoryInfo(repository!);
16+
const info = getRepositoryInfo(repository);
1717
if (!info) {
1818
redirect(302, `${base}/project-${params.region}-${params.project}/functions`);
1919
}
@@ -41,8 +41,8 @@ export const load: PageLoad = async ({ url, params, parent }) => {
4141
installations,
4242
specificationsList,
4343
repository: {
44-
url: repository,
45-
name: info.owner,
44+
url: info.url,
45+
name: info.name,
4646
owner: info.owner,
4747
rootDirectory: getNestedRootDirectory(repository)
4848
}

src/routes/(console)/project-[region]-[project]/sites/create-site/deploy/+page.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,10 @@
315315
Cancel
316316
</Button>
317317
<Button
318-
fullWidthMobile
319318
size="s"
319+
fullWidthMobile
320+
submissionLoader
321+
forceShowLoader={$isSubmitting}
320322
on:click={() => formComponent.triggerSubmit()}
321323
disabled={$isSubmitting || !domainIsValid || !domain}>
322324
Deploy

src/routes/(console)/project-[region]-[project]/sites/create-site/deploy/+page.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const load: PageLoad = async ({ url, params }) => {
1111
redirect(302, `${base}/project-${params.region}-${params.project}/sites`);
1212
}
1313

14-
const info = getRepositoryInfo(repository!);
14+
const info = getRepositoryInfo(repository);
1515
if (!info) {
1616
redirect(302, `${base}/project-${params.region}-${params.project}/sites`);
1717
}
@@ -32,10 +32,10 @@ export const load: PageLoad = async ({ url, params }) => {
3232
frameworks,
3333
installations,
3434
repository: {
35-
url: repository,
35+
url: info.url,
3636
name: info.name,
3737
owner: info.owner,
38-
rootDirectory: getNestedRootDirectory(repository!)
38+
rootDirectory: getNestedRootDirectory(repository)
3939
}
4040
};
4141
};

src/routes/(public)/functions/deploy/+page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const load: PageLoad = async ({ parent, url }) => {
5454
// Get available runtimes
5555
const runtimesList = await sdk.forConsole.functions.listRuntimes();
5656

57-
const info = getRepositoryInfo(repository!);
57+
const info = getRepositoryInfo(repository);
5858
if (!info) {
5959
redirect(302, base + '/');
6060
}

src/routes/(public)/sites/deploy/+page.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ export const load: PageLoad = async ({ parent, url }) => {
6262
error(404, `Template "${templateKey}" not found`);
6363
}
6464
} else {
65-
const info = getRepositoryInfo(repository!);
65+
const info = getRepositoryInfo(repository);
6666
if (!info) {
67-
console.log(info);
6867
redirect(302, base + '/');
6968
}
7069

0 commit comments

Comments
 (0)