Skip to content

Clarification Request: Why are template layout no longer being cloned? #216

Open
@preslavrachev

Description

@preslavrachev

Hi,

I was trying to adapt the template loading and embedding logic for my Echo-based project when I noticed this part here:

lay := e.Templates.Lookup(layout[0])

I expected to see lay.Clone() being called here, because the current solution attaches the embed func globally. This could be a potential security threat, if someone ends up rendering main.html by mistake.

Checking the history, I saw that there was a version that cloned the template, but it was replaced, because a cloned template cannot be executed multiple times. But if you are always only executing the copy, why would the original template get executed in the first place?

I would love to hear your thoughts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions