Skip to content

(Breaking) Change in register_templates_directory #549

@Nerixyz

Description

@Nerixyz

Upgrading from version 4.2.2 to 4.3.0, specifically because of #500 (580acba), might result in register_templates_directory not working identically.

In v4.2.2, you could register files with an extension that contained multiple .'s:

handlebars.register_templates_directory(".hbs.html", "templates");

This would result in all files ending in .hbs.html to be loaded. After upgrading, this breaks, as now, Path::extension is used to determine the extension:

.filter(|tpl_path| {
tpl_path
.extension()
.map(|extension| extension == tpl_extension)
.unwrap_or(false)
})

Thus, in the example above, no files would ever match, since Path::extension considers html as the extension.

The documentation doesn't mention anything regarding the format of extension.

If my use-case is invalid, then the docs should at least mention that extension must never contain a . (excluding the first character), or that Path::extension will be used to determine the extension. Furthermore, the changelog could mention, that this previously accepted but invalid use will no longer work.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions