Skip to content

Commit

Permalink
fix(FileSystem): filename on metadata response (#1600)
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
  • Loading branch information
pedrolamas authored Feb 14, 2025
1 parent 44a2b46 commit 35b6447
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/store/files/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ export const actions: ActionTree<FilesState, RootState> = {
const paths = getFilePaths(payload.filename, 'gcodes')

if (!paths.filtered) {
commit('setFileUpdate', { paths, file: payload })
// We need to update filename here as it can contain a relative path
const file: MoonrakerFileWithMeta = {
...payload,
filename: paths.filename
}

commit('setFileUpdate', { paths, file })
}
},

Expand All @@ -80,13 +86,13 @@ export const actions: ActionTree<FilesState, RootState> = {

async notifyModifyFile ({ dispatch }, payload: FileChange) { dispatch('notifyCreateFile', payload) },

async notifyCreateFile ({ commit, dispatch, rootState }, payload: FileChange) {
async notifyCreateFile ({ commit, getters, dispatch, rootState }, payload: FileChange) {
const paths = getFilePaths(payload.item.path, payload.item.root)

if (!paths.filtered) {
if (
paths.root === 'gcodes' &&
paths.extension === '.gcode'
getters.getRootProperties('gcodes').accepts.includes(paths.extension)
) {
// If the file in the gcode preview is the same as the one being updated, then reset gcode preview
const gcodePreviewFile = rootState.gcodePreview.file
Expand Down

0 comments on commit 35b6447

Please # to comment.