Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0.0 - alpha 3 - 404 when editing a project #1436

Closed
spikefishjohn opened this issue Feb 11, 2023 · 1 comment · Fixed by #1533
Closed

v3.0.0 - alpha 3 - 404 when editing a project #1436

spikefishjohn opened this issue Feb 11, 2023 · 1 comment · Fixed by #1533
Labels
Milestone

Comments

@spikefishjohn
Copy link

I made this project with the phat client and then started poking around in the webui.

When I edit the project in the webui i get a 404 from it trying to open a readme for the project.

image

@grossmj grossmj added the bug label Feb 13, 2023
@grossmj grossmj modified the milestones: 2.2.38, 3.0 Feb 13, 2023
@cristian-ciobanu
Copy link

Same happens on the GNS3 web UI version 3.0 so I think it assumes that by default the README.txt file should exist.
The change in the diff below partially fixes this 404 not found issue but if you open a project or create a new one I still can see on the console log until I add some text in the Edit Project / Readme tab and save it. Then subsequent project opening do not display the 404 not found error anymore.

GET http://127.0.0.1:3080/v3/projects/fc165189-cfd4-409d-9395-f156f60407f8/files/README.txt
404 Not Found
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 1234567..89abcde 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 = '';
+                }
+            }
         });
     }
 }

@grossmj grossmj linked a pull request Dec 23, 2024 that will close this issue
@grossmj grossmj closed this as completed Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants