mike-goodwin / owasp-threat-dragon-desktop

An installable desktop variant of OWASP Threat Dragon
Apache License 2.0
594 stars 89 forks source link

File Extension Not Applied #115

Closed nstr10 closed 4 years ago

nstr10 commented 4 years ago

When saving a new file, no file extension is added. It is unclear what file extension should be added. When opening files, none appear available because they have no file extensions.

I am running this on Ubuntu 18.04 with the Nautilus file browser.

nstr10 commented 4 years ago

Based on this the file extension should be ".json": https://github.com/mike-goodwin/owasp-threat-dragon-desktop/blob/f94e1df4e1f5f881fc38b1b03aea36d1bdecf068/app/services/electron.js#L43-L51 I'm not sure if a custom check should be written or if there is a native Node/Electron way of doing this.

jgadsden commented 4 years ago

Thanks @nstr10 - I have checked this on my debian Linux and see the same thing. On MacOS and Windows it prompts with 'Untitled.json' but not Linux. If you can get a fix for this that would be great, otherwise I can have a look later in the week.

jgadsden commented 4 years ago

Hello @nstr10 , just committed a fix where defaultPath: "new-model.json", is applied, so if you update your checkout and run it again it should work OK

nstr10 commented 4 years ago

@jgadsden that definitely helps a lot, but the behavior is still a bit unusual if you don't take the default filename. For example, if I save a file as test it doesn't get the .json extension and therefore the open dialog does not show it. Compounding this issue, at least in Nautilus, the extension is not actually shown in the file type menu. I'll do some research into Electron this weekend and try to make a pull request.

jgadsden commented 4 years ago

Thanks @nstr10 , you make a very good point. I have reopened this issue, and if you can get a fix then that would be great.

nstr10 commented 4 years ago

Submitted a workaround for the open dialog. It looks like the issue with the save dialog is being debated upstream: https://github.com/electron/electron/issues/21935