fix bug with non latin titles for claim names
hard exit when a duplicate name is attempted
This commit is contained in:
parent
bdd55c9965
commit
1b08bb0e61
3 changed files with 10 additions and 1 deletions
|
@ -209,6 +209,7 @@ func (s *SyncManager) Start() error {
|
|||
"failure uploading wallet",
|
||||
"the channel in the wallet is different than the channel in the database",
|
||||
"this channel does not belong to this wallet!",
|
||||
"You already have a stream claim published under the name",
|
||||
}
|
||||
if util.SubstringInSlice(err.Error(), fatalErrors) {
|
||||
return errors.Prefix("@Nikooo777 this requires manual intervention! Exiting...", err)
|
||||
|
|
|
@ -754,6 +754,7 @@ func (s *Sync) startWorker(workerNum int) {
|
|||
"cannot concatenate 'str' and 'NoneType' objects",
|
||||
"more than 90% of the space has been used.",
|
||||
"Couldn't find private key for id",
|
||||
"You already have a stream claim published under the name",
|
||||
}
|
||||
if util.SubstringInSlice(err.Error(), fatalErrors) || s.Manager.SyncFlags.StopOnError {
|
||||
s.grp.Stop()
|
||||
|
|
|
@ -43,9 +43,16 @@ func (n *Namer) GetNextName(prefix string) string {
|
|||
}
|
||||
|
||||
//if for some reasons the title can't be converted in a valid claim name (too short or not latin) then we use a hash
|
||||
attempt = 1
|
||||
if len(name) < 2 {
|
||||
sum := md5.Sum([]byte(prefix))
|
||||
name = fmt.Sprintf("%s-%d", hex.EncodeToString(sum[:])[:15], attempt)
|
||||
for {
|
||||
name = fmt.Sprintf("%s-%d", hex.EncodeToString(sum[:])[:15], attempt)
|
||||
if _, exists := n.names[name]; !exists {
|
||||
break
|
||||
}
|
||||
attempt++
|
||||
}
|
||||
}
|
||||
|
||||
n.names[name] = true
|
||||
|
|
Loading…
Reference in a new issue