Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal template name #121

Open
asacarter opened this issue May 11, 2019 · 0 comments
Open

Illegal template name #121

asacarter opened this issue May 11, 2019 · 0 comments
Assignees

Comments

@asacarter
Copy link

asacarter commented May 11, 2019

Given the template name page.contact, it will fail if the extensions are set to false.

Maybe it should check if the value after the . is the value of the include suffix?

Or what does it matter if it matches page.contact.liquid or page.contact?

\Liquid\Liquid::set('INCLUDE_SUFFIX', 'liquid');
\Liquid\Liquid::set('INCLUDE_PREFIX', '');
\Liquid\Liquid::set('INCLUDE_ALLOW_EXT', false);
\Liquid\Liquid::set('ESCAPE_BY_DEFAULT', false);

$template_file = 'page.contact'
$liquid->parseFile ($template_file);

FileSystem/local.php

$nameRegex = Liquid::get('INCLUDE_ALLOW_EXT')
	? new Regexp('/^[^.\/][a-zA-Z0-9_\.\/-]+$/')
	: new Regexp('/^[^.\/][a-zA-Z0-9_\/-]+$/');

if (!$nameRegex->match($templatePath)) {
	throw new ParseException("Illegal template name '$templatePath'");
}
@sanmai sanmai self-assigned this May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants