mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 14:30:38 -07:00
feat: relativeReference for render/include/layout, #395
- `relativeReference` is enabled by default, set to `false` to disable
- Referenced files are still constrained within root/partias/layouts
- fix: relative filenames are not constrained (which allows arbitrary filesystem read)
Example Usage:
{% render "../foo/bar.html" %}
Note:
../foo/bar.html' should also be within `partials` (or `root` if `partials` not set)
This commit is contained in:
+4
-4
@@ -64,11 +64,11 @@ export class Liquid {
|
||||
return toValue(this._parseAndRender(html, scope, true))
|
||||
}
|
||||
|
||||
public _parsePartialFile (file: string, sync?: boolean) {
|
||||
return this.parser.parseFile(file, sync, LookupType.Partials)
|
||||
public _parsePartialFile (file: string, sync?: boolean, currentFile?: string) {
|
||||
return this.parser.parseFile(file, sync, LookupType.Partials, currentFile)
|
||||
}
|
||||
public _parseLayoutFile (file: string, sync?: boolean) {
|
||||
return this.parser.parseFile(file, sync, LookupType.Layouts)
|
||||
public _parseLayoutFile (file: string, sync?: boolean, currentFile?: string) {
|
||||
return this.parser.parseFile(file, sync, LookupType.Layouts, currentFile)
|
||||
}
|
||||
public async parseFile (file: string): Promise<Template[]> {
|
||||
return toPromise(this.parser.parseFile(file, false))
|
||||
|
||||
Reference in New Issue
Block a user