fix(plugins): preserve top-level hidden restore entries (#6378)

This commit is contained in:
InfinityPacer
2026-08-21 19:09:33 +08:00
committed by GitHub
parent 6404a3aa58
commit c59a852b8d
+6 -1
View File
@@ -165,7 +165,7 @@ class SystemChain(ChainBase):
for item in backup_dir.iterdir():
if (
item.name == SystemChain._plugin_restore_pending_file
or item.name.startswith(".")
or SystemChain.__is_snapshot_artifact(item.name)
):
continue
target_path = plugins_dir / item.name
@@ -205,6 +205,11 @@ class SystemChain(ChainBase):
if backup_dir.exists():
SystemChain.__write_plugin_restore_pending(pending_file, {})
@staticmethod
def __is_snapshot_artifact(name: str) -> bool:
"""识别快照替换过程中生成的临时或旧快照条目。"""
return bool(re.fullmatch(r"\..+\.(?:tmp|old)-[0-9a-f]{32}", name))
@staticmethod
def __read_plugin_restore_pending(pending_file: Path) -> Optional[dict[str, bool]]:
"""读取仍需恢复的插件项目;无效内容按全部项目重试。"""