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

fix: stop duplication of path in template dir #440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

richdouglasevans
Copy link

Closes #437

When the root option is passed explicitly and the art-template engine is in use, the root value is being duplicated in the resolved template directory.

This leads to an error like this: notice how templates is present twice in the path.

-{"statusCode":500,"error":"Internal Server Error","message":"template not found:
'/home/rich/point-of-view/templates/templates/index.art'"}

The fix is to remove this duplication. The resolveTemplateDir function already uses any root option (if present) so there's no need to consider it again.

Checklist

Closes fastify#437

When the `root` option is passed explicitly and the `art-template` engine is in use, the `root` value is being duplicated in the resolved template directory.

This leads to an error like this: notice how `templates` is present twice in the path.

```
  -{"statusCode":500,"error":"Internal Server Error","message":"template not found: ENOENT: no such file or directory, open
  '/home/rich/point-of-view/templates/templates/index.art'"}
```

The fix is to remove this duplication. The `resolveTemplateDir` function already uses any `root` option (if present) so there's no need to consider it again.
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

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

Successfully merging this pull request may close these issues.

Bug: The root path is spliced repeatedly.
2 participants