Skip to content

filePathStem bug #3932

@baoqianz

Description

@baoqianz

Problem

Image

I find an issue with filePathStem, when a file path starts with a dir of single char name, e.g. 1/2025.11ty.js,
the filePathStem will resolve to /2025 rather than the correct one /1/2025.

Root Cause

I've found the root cause in the file https://github.com/11ty/eleventy/blob/main/src/TemplateFileSlug.js, line:12:
this.cleanInputPath = inputPath.replace(/^.\//, ""); <== the bug
The dot sign within the regex should be escaped as follow, please check and review.
this.cleanInputPath = inputPath.replace(/^\.\//, "");

Regards,

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