Skip to content

Commit

Permalink
fix: allow saving empty files
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas committed Feb 12, 2025
1 parent 585758a commit fa6ecb8
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/components/widgets/filesystem/FileSystem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -846,23 +846,21 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
}
async handleSaveFileChanges (contents: string, restart: string) {
if (contents.length > 0) {
const file = new File([contents], this.fileEditorDialogState.filename)
if (!restart && this.fileEditorDialogState.open) this.fileEditorDialogState.loading = true
await this.uploadFile(file, this.visiblePath, this.currentRoot, false)
this.fileEditorDialogState.loading = false
if (restart) {
if (restart === 'moonraker') {
this.serviceRestartMoonraker()
return
}
if (restart === 'klipper') {
this.firmwareRestartKlippy()
return
}
this.serviceRestartByName(restart)
const file = new File([contents], this.fileEditorDialogState.filename)
if (!restart && this.fileEditorDialogState.open) this.fileEditorDialogState.loading = true
await this.uploadFile(file, this.visiblePath, this.currentRoot, false)
this.fileEditorDialogState.loading = false
if (restart) {
if (restart === 'moonraker') {
this.serviceRestartMoonraker()
return
}
if (restart === 'klipper') {
this.firmwareRestartKlippy()
return
}
this.serviceRestartByName(restart)
}
}
Expand Down

0 comments on commit fa6ecb8

Please sign in to comment.