Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tags: b3/fork-templer

Tags

rootpath-fix

Toggle rootpath-fix's commit message
Fixed a bug in RootPath computation due to incorrect input path speci…

…fication verification.

In Site.pm I added code in order to ensure `input` and `output` variables
contain a trailing slash in order to fix a bug with the asset copying process
when this is not the case (files trying to be copied in / by tar).

In Site.pm the init() method ensured input field contains a trailing
slash. Unfortunately the build() method sends the `cfg` hash to
expand_variables(). I thus simply add the `input` (and `output`)
modification (trailing slash insurance) into `cfg`.

Moreover the `root_path` computation in RootPath.pm was written (and shamely
not tested in other cases) using `input` path with no trailing slash, which
was OK at that time since plugins do not receive the corrected value. I fixed
it in order to be coherent with the new state of `input`.

I am still not sure to really understand why these data (input and output) are
present twice (in a direct field and in the cfg hash) in the Site object.

Some more tests should be added into t/test-templer-plugin-rootpath.t (with
different values of `input` with trailing slash or not, with relative or
absoute value, with page at the first or higher level of hierarchy).