数据同步支持接入第三方 WebDAV 服务 https://github.com/siyuan-note/siyuan/issues/6446

This commit is contained in:
Liang Ding 2022-11-02 23:33:05 +08:00
parent d7f6456424
commit b6a1512105
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 87 additions and 30 deletions

View file

@ -159,3 +159,17 @@ func GetChildDocDepth(treeAbsPath string) (ret int) {
ret = depth - baseDepth
return
}
func NormalizeEndpoint(endpoint string) string {
endpoint = strings.TrimSpace(endpoint)
if "" == endpoint {
return ""
}
if !strings.HasPrefix(endpoint, "http://") && !strings.HasPrefix(endpoint, "https://") {
endpoint = "http://" + endpoint
}
if !strings.HasSuffix(endpoint, "/") {
endpoint = endpoint + "/"
}
return endpoint
}