drashland / drash

A microframework for building JavaScript HTTP applications. Runtime-agnostic. Strongly typed.

Home Page:https://drash.land/drash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: check for trailing/leading slash in jae

crookse opened this issue · comments

Summary

What:

Jae (in Tengine) line 76 concatenates this.views_path and template. The expected strings should look like:

this.view_path = "./views";

template = "/some-template.html"

... so that the concatenation becomes ./views/some-template.html. However, users most likely do:

this.view_path = "./views";

template = "some-template.html"

... so that the concatenation becomes ./viewssome-template.html. This results in an error.

We need to make sure of the following:

  • If this.views_path has a trailing slash and template has a leading slash, then remove one of them
  • If this.views_path does not have a trailing slash and template does not have a leading slash, then add the slash.

This makes Jae less error prone and it does not matter if the user has a random combination of trailing/leading slashes -- Jae wlll figure out what to do.

Why:

Users expect to use Tengine differently.

Acceptance Criteria

Below is a list of tasks that must be completed before this issue can be closed.

  • Write documentation
  • Write unit tests
  • Write integration tests