Skip to content

Commit

Permalink
ADD folder filter for file id extractor.
Browse files Browse the repository at this point in the history
  • Loading branch information
karminski committed Nov 9, 2023
1 parent 290ca46 commit 27a46ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/utils/illadrivesdk/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ func ExtractRawFilesFromListResponse(listResponse map[string]interface{}) ([]map
func ExtractFileIDFromRawFiles(files []map[string]interface{}) ([]string, error) {
fileIDs := make([]string, 0)
for _, file := range files {
fileType, hitFileType := file["type"]
if !hitFileType {
return nil, errors.New("missing field type from files data")
}
fileTypeString, fileTypeAssertPass := fileType.(string)
if !fileIDAssertPass {
return nil, errors.New("invalied file type data type")
}
// we should only download file, not folder
if fileTypeString != "file" {
continue
}
fileID, hitFileID := file["id"]
if !hitFileID {
return nil, errors.New("missing field id from files data")
Expand Down

0 comments on commit 27a46ef

Please sign in to comment.