diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index 05f5b506..10107453 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -545,7 +545,14 @@ $(function() { }; self._handleUploadFail = function(e, data) { - var error = "
" + gettext("Could not upload the file. Make sure that it is a GCODE file and has the extension \".gcode\" or \".gco\" or that it is an STL file with the extension \".stl\".") + "
"; + var extensions = _.map(SUPPORTED_EXTENSIONS, function(extension) { + return extension.toLowerCase(); + }).sort(); + extensions = extensions.join(", "); + var error = "" + + _.sprintf(gettext("Could not upload the file. Make sure that it is a valid file with one of these extensions: %(extensions)s"), + {extensions: extensions}) + + "
"; error += pnotifyAdditionalInfo("" + data.jqXHR.responseText + ""); new PNotify({ title: "Upload failed", diff --git a/src/octoprint/templates/initscript.jinja2 b/src/octoprint/templates/initscript.jinja2 index 5763a7ee..9ca5b4bd 100644 --- a/src/octoprint/templates/initscript.jinja2 +++ b/src/octoprint/templates/initscript.jinja2 @@ -29,6 +29,7 @@ var BRANCH = "{{ branch|e }}"; var LOCALE = "{{ g.locale|e }}"; var AVAILABLE_LOCALES = {{ locales|tojson }}; + var SUPPORTED_EXTENSIONS = {{ supportedExtensions|tojson }}; var OCTOPRINT_VIEWMODELS = []; var ADDITIONAL_VIEWMODELS = [];