feat: add root dir support.

This commit is contained in:
lishuang
2023-07-22 15:35:45 +08:00
parent da5b04cdb3
commit 42468e9711
3 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -232,7 +232,7 @@ func (this *MatterController) Crawl(writer http.ResponseWriter, request *http.Re
var dirMatter *Matter var dirMatter *Matter
if puuid == "" { if puuid == "" {
dirMatter = this.matterDao.CheckByUuid(puuid) dirMatter = this.matterDao.CheckWithRootByUuid(puuid, space)
if dirMatter.SpaceUuid != space.Uuid { if dirMatter.SpaceUuid != space.Uuid {
panic(result.UNAUTHORIZED) panic(result.UNAUTHORIZED)
} }
+1 -1
View File
@@ -65,7 +65,7 @@ func (this *MatterDao) CheckWithRootByUuid(uuid string, space *Space) *Matter {
var matter *Matter var matter *Matter
if uuid == MATTER_ROOT { if uuid == MATTER_ROOT {
if space == nil { if space == nil {
panic(result.BadRequest("user cannot be null.")) panic(result.BadRequest("space cannot be null."))
} }
matter = NewRootMatter(space) matter = NewRootMatter(space)
} else { } else {
+6 -5
View File
@@ -151,11 +151,12 @@ func (this *Matter) FetchPropMap() map[string]string {
func (this *Matter) SetPropMap(propMap map[string]string) { func (this *Matter) SetPropMap(propMap map[string]string) {
//恢复panic //恢复panic
//defer func() { defer func() {
// if err := recover(); err != nil { fmt.Printf("panic recover check")
// fmt.Printf("occur error while set prop map %s\r\n", err) if err := recover(); err != nil {
// } fmt.Printf("occur error while set prop map %s\r\n", err)
//}() }
}()
b, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(propMap) b, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(propMap)
if err != nil { if err != nil {