Disallow duplicate storage paths (#26484)

Replace #26380
This commit is contained in:
2024-02-09 22:06:03 +08:00
committed by GitHub
parent c7a21cbb0c
commit 92fda9c5a2
7 changed files with 42 additions and 20 deletions

View File

@ -226,3 +226,12 @@ func LoadSettingsForInstall() {
loadServiceFrom(CfgProvider)
loadMailerFrom(CfgProvider)
}
var uniquePaths = make(map[string]string)
func fatalDuplicatedPath(name, p string) {
if targetName, ok := uniquePaths[p]; ok && targetName != name {
log.Fatal("storage path %q is being used by %q and %q and all storage paths must be unique to prevent data loss.", p, targetName, name)
}
uniquePaths[p] = name
}