* limitations under the License.
*/
+#include <regex>
#include "CustomTemplate.h"
static std::list<CustomTemplate> __instances;
{
IF_FAIL_RETURN(!get(name), false);
- //TODO: validity check of the name (regex)
+ static std::regex nameRegex(R"~(^[\w-\._\/]+$)~", std::regex::optimize);
+ IF_FAIL_RETURN_TAG(std::regex_match(name, nameRegex), false, _E, "Invalid name");
Json::Reader reader;
Json::Value tmplJson;
}
//TODO: further validity check of the template
+ // Does it contain all necessary fields, ...?
__instances.emplace_back(name, tmplJson);