Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Files with certain names are incorrectly excluded (by FileExclusionSpecification) #38

@rogersillito

Description

@rogersillito

At template creation, when figuring out what files to exclude, if a directory segment, or filename string contains a DirectoryExclusions or FileExclusions value it gets excluded (I believe against the intent of the code?).

For example, I have a file (within a tree being Templified) whose path is:

"C:\DEV\template_solution\released_version\Update_all_packages.cmd"

this gets excluded because (a) the default FileExclusions config contain an entry for:

".pack"

...and (b) the DirectoryExclusions config contains an entry for:

"release"

I imagine this intended to match a file with a ".pack" extension, and a folder named "release"? However as it gets matched via regex, the "." acts as a wildcard and so it matches the above filename. Similarly, the directory name contains the exclusion string so that matches too.

I believe this would still behave as required (and fix this issue) if these calls to Regex.IsMatch were replaced by simple string matching such as:

directories:
bool shouldExclude = segments.Any(directory => this.DirectoryExclusions.Any(exclusion => directory.Equals(exclusion))));

files:
shouldExclude = this.FileExclusions.Any(exclusion => file.EndsWith(exclusion));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions