mirror of https://github.com/cloudreve/Cloudreve
fix(upgrade v3): validation on unique magic var in either blob name or path (#2890)
* fix(upgrade v3): validation on unique magic var in either blob name or path * Update policy.gopull/2897/head
parent
7d97237593
commit
9434c2f29b
|
@ -103,10 +103,6 @@ func (m *Migrator) migratePolicy() (map[int]bool, error) {
|
|||
settings.ProxyServer = policy.OptionsSerialized.OdProxy
|
||||
}
|
||||
|
||||
if policy.DirNameRule == "" {
|
||||
policy.DirNameRule = "uploads/{uid}/{path}"
|
||||
}
|
||||
|
||||
if policy.Type == types.PolicyTypeCos {
|
||||
settings.ChunkSize = 1024 * 1024 * 25
|
||||
}
|
||||
|
@ -122,8 +118,16 @@ func (m *Migrator) migratePolicy() (map[int]bool, error) {
|
|||
hasRandomElement = true
|
||||
break
|
||||
}
|
||||
|
||||
if strings.Contains(policy.DirNameRule, c) {
|
||||
hasRandomElement = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasRandomElement {
|
||||
if policy.DirNameRule == "" {
|
||||
policy.DirNameRule = "uploads/{uid}/{path}"
|
||||
}
|
||||
policy.FileNameRule = "{uid}_{randomkey8}_{originname}"
|
||||
m.l.Warning("Storage policy %q has no random element in file name rule, using default file name rule.", policy.Name)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue