From 711d565c189d37c9437801f550a9e1ef9a807904 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Tue, 27 Nov 2018 15:34:16 -0800 Subject: [PATCH] Fixed problem with cached GCode file upload when file changed on disk. --- CHANGELOG.md | 1 + src/js/control-view.js | 6 ++++-- src/pug/templates/control-view.pug | 6 +++--- src/stylus/style.styl | 3 +++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26c4b2c..f75effb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Buildbotics CNC Controller Firmware Changelog - Improved switch debouncing for better homing. - Removed tool-reversed option. Use tool-direction-mode instead. - Handle zero length dwell correctly. + - Fixed problem with cached GCode file upload when file changed on disk. ## v0.4.1 - Fix toolpath view axes bug. diff --git a/src/js/control-view.js b/src/js/control-view.js index 81af75e..d5cd60b 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -273,8 +273,10 @@ module.exports = { open: function (e) { - // TODO browser caches file if name is same even if contents changed - $('.gcode-file-input').click(); + // If we don't reset the form the browser may cache file if name is same + // even if contents have changed + $('.gcode-file-input')[0].reset(); + $('.gcode-file-input input').click(); }, diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index 1b71974..bc1d822 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -228,9 +228,9 @@ script#control-view-template(type="text/x-template") :disabled="!is_ready") .fa.fa-folder-open - input.gcode-file-input(type="file", @change="upload", - style="display:none", accept=".nc,.gcode,.gc,.ngc,.txt,.tap,.cnc", - :disabled="!is_ready") + form.gcode-file-input + input(type="file", @change="upload", :disabled="!is_ready", + accept="text/*,.nc,.gcode,.gc,.ngc,.txt,.tap,.cnc") button.pure-button(title="Delete current GCode program.", @click="deleteGCode = true", diff --git a/src/stylus/style.styl b/src/stylus/style.styl index e893336..0fecd72 100644 --- a/src/stylus/style.styl +++ b/src/stylus/style.styl @@ -409,6 +409,9 @@ span.unit select max-width 13em + .gcode-file-input + display none + .tabs section min-height 500px -- 2.27.0