From 682c3dd8e3348b09518d933df14df2714cfc4f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 9 Feb 2016 18:03:04 +0100 Subject: [PATCH] Limit file upload dialogs to supported file extensions See #1196 --- src/octoprint/server/views.py | 4 +++- src/octoprint/templates/sidebar/files.jinja2 | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 8c58a766..59f19a31 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -16,6 +16,7 @@ from octoprint.server import app, userManager, pluginManager, gettext, \ debug, LOCALES, VERSION, DISPLAY_VERSION, UI_API_KEY, BRANCH, preemptiveCache, \ NOT_MODIFIED from octoprint.settings import settings +from octoprint.filemanager import get_all_extensions import re @@ -297,7 +298,8 @@ def index(): uiApiKey=UI_API_KEY, templates=templates, pluginNames=plugin_names, - locales=locales + locales=locales, + supportedExtensions=map(lambda ext: ".{}".format(ext), get_all_extensions()) ) render_kwargs.update(plugin_vars) diff --git a/src/octoprint/templates/sidebar/files.jinja2 b/src/octoprint/templates/sidebar/files.jinja2 index 39b4d9c8..fbff0ce8 100644 --- a/src/octoprint/templates/sidebar/files.jinja2 +++ b/src/octoprint/templates/sidebar/files.jinja2 @@ -42,18 +42,18 @@ {{ _('Upload') }} - + {{ _('Upload to SD') }} - + {% else %} {{ _('Upload') }} - + {% endif %}