mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-30 21:38:48 +01:00
🎨 Improve cloud dir name check
This commit is contained in:
parent
5a8a7f946b
commit
072a97af90
2 changed files with 9 additions and 3 deletions
|
|
@ -628,8 +628,14 @@ func contextPushMsg(context map[string]interface{}, msg string) {
|
|||
}
|
||||
|
||||
func buildCloudInfo() (ret *dejavu.CloudInfo, err error) {
|
||||
if nil == Conf.User || "" == Conf.Sync.CloudName {
|
||||
err = errors.New("invalid cloud info")
|
||||
if !IsValidCloudDirName(Conf.Sync.CloudName) {
|
||||
util.LogWarnf("invalid cloud repo name, rename it to [main]")
|
||||
Conf.Sync.CloudName = "main"
|
||||
Conf.Save()
|
||||
}
|
||||
|
||||
if nil == Conf.User {
|
||||
err = errors.New("user auth failed")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1265,7 +1265,7 @@ func formatErrorMsg(err error) string {
|
|||
}
|
||||
|
||||
func IsValidCloudDirName(cloudDirName string) bool {
|
||||
if 16 < utf8.RuneCountInString(cloudDirName) {
|
||||
if 16 < utf8.RuneCountInString(cloudDirName) || 1 > utf8.RuneCountInString(cloudDirName) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue