Fixed problem with cached GCode file upload when file changed on disk.
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 27 Nov 2018 23:34:16 +0000 (15:34 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 27 Nov 2018 23:35:37 +0000 (15:35 -0800)
CHANGELOG.md
src/js/control-view.js
src/pug/templates/control-view.pug
src/stylus/style.styl

index 26c4b2c6db2ad5d756538cb46ce4050dc0ce5948..f75effb280f64deb925f9b43954e93e2e6f5322b 100644 (file)
@@ -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.
index 81af75ec3715a7ca62caed0892ac11678edc95c6..d5cd60b05b8a4034adfae788b9ec8d1b20fce4a9 100644 (file)
@@ -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();
     },
 
 
index 1b719746e639da4fd730edfe47706dd94885d823..bc1d822dcdfd2e91c5fc29932728e55aa8847c08 100644 (file)
@@ -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",
index e893336280ccd4b32473fab3808ddea6228e3b37..0fecd721d42685b67a87aca6cd86c5c794eddb03 100644 (file)
@@ -409,6 +409,9 @@ span.unit
     select
       max-width 13em
 
+    .gcode-file-input
+      display none
+
   .tabs
     section
       min-height 500px