1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-02 07:54:27 +00:00

Merge same repo once and check fs object is valid (#578)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks
2022-09-28 16:43:07 +08:00
committed by GitHub
parent 550e75cb0b
commit 04350f2b99
8 changed files with 127 additions and 46 deletions

24
fileserver/utils/utils.go Normal file
View File

@@ -0,0 +1,24 @@
package utils
import (
"github.com/google/uuid"
)
func IsValidUUID(u string) bool {
_, err := uuid.Parse(u)
return err == nil
}
func IsObjectIDValid(objID string) bool {
if len(objID) != 40 {
return false
}
for i := 0; i < len(objID); i++ {
c := objID[i]
if (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') {
continue
}
return false
}
return true
}