From cddce63e2b5498e2bbfb50c61b445e27422d0a8f Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 23 Dec 2024 15:44:43 +0700 Subject: [PATCH] Fix error 404 when editing a project --- .../readme-editor/readme-editor.component.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.ts b/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.ts index 026a0d21..0257359c 100644 --- a/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.ts +++ b/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.ts @@ -21,8 +21,18 @@ export class ReadmeEditorComponent implements OnInit { ) {} ngOnInit() { - this.projectService.getReadmeFile(this.controller, this.project.project_id).subscribe(file => { - if (file) this.markdown = file; + this.projectService.getReadmeFile(this.controller, this.project.project_id).subscribe({ + next: (file) => { + if (file) { + this.markdown = file; + } + }, + error: (err) => { + if (err.status === 404) { + // File doesn't exist yet, which is fine + this.markdown = ''; + } + } }); } }