(projectRoot: string, id: string)
| 134 | * written — checked before the join, so nothing path-shaped is ever built. |
| 135 | */ |
| 136 | export function trailPath(projectRoot: string, id: string): string { |
| 137 | if (!isTrailId(id)) { |
| 138 | throw badRequest( |
| 139 | `"${id}" is not a saved trail id.`, |
| 140 | 'Trail ids are the lowercase slug in the file name, e.g. "how-a-request-is-served".' |
| 141 | ); |
| 142 | } |
| 143 | return resolveProjectFile(projectRoot, `${TRAILS_RELATIVE_DIR}/${id}.json`); |
| 144 | } |
| 145 | |
| 146 | /* ------------------------------------------------------------------- read -- */ |
| 147 |
no test coverage detected