(rawObject []any)
| 95 | } |
| 96 | |
| 97 | func parseRawFileObject(rawObject []any) ([]model.Obj, error) { |
| 98 | objectList := make([]model.Obj, 0) |
| 99 | for _, each := range rawObject { |
| 100 | object := each.(map[string]any) |
| 101 | if object["id"].(string) == "0" { |
| 102 | continue |
| 103 | } |
| 104 | isFolder := int64(object["ty"].(float64)) == 1 |
| 105 | var name string |
| 106 | if object["ext"].(string) != "" { |
| 107 | name = strings.Join([]string{object["name"].(string), object["ext"].(string)}, ".") |
| 108 | } else { |
| 109 | name = object["name"].(string) |
| 110 | } |
| 111 | modified, err := time.Parse("2006/01/02 15:04:05", object["modified"].(string)) |
| 112 | if err != nil { |
| 113 | return nil, err |
| 114 | } |
| 115 | objectList = append(objectList, model.Obj(&model.Object{ |
| 116 | ID: strings.Join([]string{object["id"].(string), strings.Split(object["uploadurl"].(string), "=")[1]}, "_"), |
| 117 | Name: provider2local(name), |
| 118 | Size: int64(object["byte"].(float64)), |
| 119 | Modified: modified.Add(-210 * time.Minute), |
| 120 | IsFolder: isFolder, |
| 121 | })) |
| 122 | } |
| 123 | return objectList, nil |
| 124 | } |
no test coverage detected