Skip to content

[BUGFIX] Keep excludes with escaped slashes working - #107

Merged
bmack merged 1 commit into
mainfrom
bugfix/exclude-escaped-slash
Sep 1, 2026
Merged

[BUGFIX] Keep excludes with escaped slashes working#107
bmack merged 1 commit into
mainfrom
bugfix/exclude-escaped-slash

Conversation

@bmack

@bmack bmack commented Sep 1, 2026

Copy link
Copy Markdown
Member

Follow-up to #106, addressing the breaking change @eliashaeussler pointed out.

#106 quotes the configured exclude entries so a nested directory name such as Resources/Private/Build no longer closes the pattern early. Extensions that already worked around that by escaping the slashes themselves — Resources\/Private\/Build, see the code search — now hand a backslash to preg_quote, which escapes it in turn. The resulting pattern matches only a directory whose name literally contains a backslash, so those extensions silently package the directory they meant to exclude.

The fix strips the escaped slashes before quoting, in a small quoteExcludePattern() helper used for both the directory and the file rule. Both notations then describe the same directory and no extension configuration needs to change — nothing about this is breaking any more.

The added test packages the same tree as the one from #106, but with the escaped fixture configuration. Against this branch without the str_replace() it fails with Failed asserting that an array does not contain 'Resources/Private/Build/gulpfile.js'; with it, the unit suite is green (154 tests) and composer cs reports no findings.

The README section on excluding paths now spells out how the entries are matched and that both notations are accepted.

https://claude.ai/code/session_018cdX1rvZ9kZjub3MjjQnY4

Quoting the configured exclude entries (#106) broke the workaround
extensions used for nested directories: an entry written as
`Resources\/Private\/Build` was passed to preg_quote as is, so the
backslash itself got escaped and the resulting pattern only matched a
directory whose name literally contains a backslash. Those extensions
silently packaged the directory they excluded before.

Strip the escaped slashes before quoting, so both notations describe
the same directory and no extension configuration needs a change.
@eliashaeussler

Copy link
Copy Markdown
Member

Thanks for the follow-up! ❤️

@bmack
bmack merged commit 7faa2d2 into main Sep 1, 2026
18 checks passed
@bmack
bmack deleted the bugfix/exclude-escaped-slash branch September 1, 2026 16:40
CybotTM added a commit to CybotTM/tailor that referenced this pull request Sep 2, 2026
An exclude entry that quietly matches nothing is the failure the whole
filter exists to prevent: a published archive carrying the very directory
the configuration was supposed to keep out. `Resources/Private/Build/`
written with a trailing slash, with a leading `./` or with backslashes as
separators reads like a valid exclude and packages the directory anyway,
without a warning and without an error.

Report an entry when the created archive still contains what the entry
names, together with a hint about the most likely reason. Comparing
against the packaged paths rather than counting pattern matches keeps
two cases quiet which are not a problem: an entry for a directory the
extension does not have - exclude configurations are shared between
extensions and the shipped default covers a lot of them - and an entry
already covered by a shorter one next to it.

Entries still written with escaped slashes are reported as well, since
the escaping is only accepted for compatibility since TYPO3#107.

Assisted-by: claude-code:claude-opus-5
Agent-Session: https://claude.ai/code/session_01CFdZJzsCjJ7rmT1u9snkiv
Agent-Host: 0493f0
Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
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.

2 participants