Browse Source

handle missing leading zero padding in replica

pull/6090/head
chrislu 3 months ago
parent
commit
7dd480acad
  1. 8
      weed/storage/super_block/replica_placement.go

8
weed/storage/super_block/replica_placement.go

@ -12,6 +12,14 @@ type ReplicaPlacement struct {
func NewReplicaPlacementFromString(t string) (*ReplicaPlacement, error) { func NewReplicaPlacementFromString(t string) (*ReplicaPlacement, error) {
rp := &ReplicaPlacement{} rp := &ReplicaPlacement{}
switch len(t) {
case 0:
t = "000"
case 1:
t = "00" + t
case 2:
t = "0" + t
}
for i, c := range t { for i, c := range t {
count := int(c - '0') count := int(c - '0')
if count < 0 { if count < 0 {

Loading…
Cancel
Save