mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
[automation] Allow dashes in rule file names (#1750)
* Allow dashes in rule file names Fixes #1728 Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
3df4403268
commit
749b8f17fe
@ -87,10 +87,10 @@ public class DSLScriptEngine implements javax.script.ScriptEngine {
|
||||
if (script.stripLeading().startsWith(DSLScriptContextProvider.CONTEXT_IDENTIFIER)) {
|
||||
String contextString = script.stripLeading().substring(
|
||||
DSLScriptContextProvider.CONTEXT_IDENTIFIER.length(), script.stripLeading().indexOf('\n'));
|
||||
String[] segments = contextString.split("-");
|
||||
if (segments.length == 2) {
|
||||
modelName = segments[0];
|
||||
String ruleIndex = segments[1];
|
||||
if (contextString.contains("-")) {
|
||||
int indexLastDash = contextString.lastIndexOf('-');
|
||||
modelName = contextString.substring(0, indexLastDash);
|
||||
String ruleIndex = contextString.substring(indexLastDash + 1);
|
||||
if (contextProvider != null) {
|
||||
DSLScriptContextProvider cp = contextProvider;
|
||||
logger.debug("Script uses context '{}'.", contextString);
|
||||
|
Loading…
Reference in New Issue
Block a user