From fa682c551ed12dd3c8e11bd712c6f434820ca371 Mon Sep 17 00:00:00 2001 From: Yannick Schaus Date: Sun, 19 Dec 2021 20:01:48 +0100 Subject: [PATCH] Improve logic to choose a script engine preferred MIME type (#2629) As discussed in https://github.com/openhab/openhab-addons/issues/11818. This should select `application/x-python` for Jython (instead of `application/python` currently) and allow other script engines to advertise their MIME type: - JRuby: `application/x-ruby` - Groovy: `application/x-groovy` Signed-off-by: Yannick Schaus --- .../script/internal/provider/ScriptModuleTypeProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/provider/ScriptModuleTypeProvider.java b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/provider/ScriptModuleTypeProvider.java index c9ff81601f..f761fb4e77 100644 --- a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/provider/ScriptModuleTypeProvider.java +++ b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/provider/ScriptModuleTypeProvider.java @@ -176,7 +176,7 @@ public class ScriptModuleTypeProvider implements ModuleTypeProvider { private String getPreferredMimeType(ScriptEngineFactory factory) { List mimeTypes = new ArrayList<>(factory.getScriptTypes()); - mimeTypes.removeIf(mimeType -> !mimeType.contains("application") || mimeType.contains("x-")); + mimeTypes.removeIf(mimeType -> !mimeType.contains("application") || "application/python".equals(mimeType)); return mimeTypes.isEmpty() ? factory.getScriptTypes().get(0) : mimeTypes.get(0); }