Openui5: new "module:…" syntax for onInit does not support "-" in module paths.

Created on 22 May 2018  Â·  2Comments  Â·  Source: SAP/openui5

I'm not sure if this is a bug or missing documentation or if I just haven't read the correct parts of the documentation so if this is not a bug, sorry for opening this ticket:

OpenUI5 version: ^1.54

Steps to reproduce the problem:

  1. use the new module syntax for bootstraping
<script … data-sap-ui-oninit="module:com/example/cool-app/init">
  1. Open the HTML file in a browser

What is the expected result?

UI5 should load the module and execute it, like descriped in the announcement or the docs.

What happens instead?

UI5 tries to globalEval the "module:..." sting, which fails.

Any other information?

This may be intended if a "-" in a module name should not be allowed, but I guess this should be checked in a lof of other places as well then.

Heres what causes the issue:
https://github.com/SAP/openui5/blob/c44885a2bb18d1238c79fffac02a42cb4d9e0b05/src/sap.ui.core/src/sap/ui/core/Core.js#L1115
The rexexp does not include the - character.

Adding a - to the end of the last character class should fix the issue:

var aResult = /^module\:((?:(?:[_$a-zA-Z][_$a-zA-Z0-9-]*)\/?)*)$/.exec(vOnInit); 
bug

All 2 comments

Hi Mark,

thanks for reporting this issue. We will extend the regex soon for the - and for more characters which are allowed on our supported platforms.

I will take care to fix the issue.

BR,
Peter

The issue will be fixed soon in master, 1.56 and 1.54

Was this page helpful?
0 / 5 - 0 ratings