Skip to content

Commit

Permalink
Update filenames of JSON keymap exports (#1335)
Browse files Browse the repository at this point in the history
Updates the filenames of JSON keymap exports to include the name of the
keyboard if the keymap name is given, instead of only the keymap name.
  • Loading branch information
noroadsleft authored Apr 1, 2024
1 parent e730d4d commit 39d4aad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/store/modules/app/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ const getters = {
filter: (state) => state.filter,
exportKeymapName: (state) => {
let exportName = state.keymapName.replace(/[\s/]/g, '_').toLowerCase();
let keyboardName = state.keyboard.replace(/[\s/]/g, '_').toLowerCase();
if (exportName === '') {
let keyboardName = state.keyboard.replace(/[\s/]/g, '_').toLowerCase();
exportName = `${keyboardName}_${state.layout}_mine`.toLowerCase();
} else {
exportName = `${keyboardName}_${exportName}`.toLowerCase();
}
// issue #331 whitelist what we send to API for keymapName and save to disk
exportName = exportName.replace(/[^a-z0-9_-]/gi, '');
Expand Down

0 comments on commit 39d4aad

Please sign in to comment.