mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-09 11:32:48 +08:00
fix(update): 修复目录忽略逻辑的前缀匹配误命中问题
isIgnoredPath 和 testIsOptionalFiles 方法使用 str_starts_with 做前缀匹配, 导致 .gitea 被 .git 规则误跳过,.gitignore/.gitattributes 同样受影响。 改为精确目录名匹配: === || str_starts_with(, . '/')
This commit is contained in:
@@ -347,7 +347,7 @@ class AdminUpdateServiceBase
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach ($optional_files_prefix as $prefix) {
|
foreach ($optional_files_prefix as $prefix) {
|
||||||
if (str_starts_with($file_path, $prefix)) {
|
if ($file_path === $prefix || str_starts_with($file_path, $prefix . '/')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -393,7 +393,7 @@ class AdminUpdateServiceBase
|
|||||||
protected function isIgnoredPath(string $path, array $ignore_prefix)
|
protected function isIgnoredPath(string $path, array $ignore_prefix)
|
||||||
{
|
{
|
||||||
foreach ($ignore_prefix as $prefix) {
|
foreach ($ignore_prefix as $prefix) {
|
||||||
if (str_starts_with($path, $prefix)) {
|
if ($path === $prefix || str_starts_with($path, $prefix . '/')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user