|
|
@@ -31,24 +31,25 @@ func DirIndex(ctx *context.Context) { |
|
|
|
parentDir := ctx.Query("parentDir") |
|
|
|
dirArray := strings.Split(parentDir, "/") |
|
|
|
|
|
|
|
if parentDir == "" { |
|
|
|
attachment, err := models.GetAttachmentByUUID(uuid) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("GetDatasetAttachments", err) |
|
|
|
return |
|
|
|
} |
|
|
|
attachment, err := models.GetAttachmentByUUID(uuid) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("GetDatasetAttachments", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if !strings.HasSuffix(attachment.Name, ".zip") { |
|
|
|
log.Error("The file is not zip file, can not query the dir") |
|
|
|
ctx.ServerError("The file is not zip file, can not query the dir", errors.New("The file is not zip file, can not query the dir")) |
|
|
|
return |
|
|
|
} else if attachment.DecompressState != models.DecompressStateDone { |
|
|
|
log.Error("The file has not been decompressed completely now") |
|
|
|
ctx.ServerError("The file has not been decompressed completely now", errors.New("The file has not been decompressed completely now")) |
|
|
|
return |
|
|
|
} |
|
|
|
if !strings.HasSuffix(attachment.Name, ".zip") { |
|
|
|
log.Error("The file is not zip file, can not query the dir") |
|
|
|
ctx.ServerError("The file is not zip file, can not query the dir", errors.New("The file is not zip file, can not query the dir")) |
|
|
|
return |
|
|
|
} else if attachment.DecompressState != models.DecompressStateDone { |
|
|
|
log.Error("The file has not been decompressed completely now") |
|
|
|
ctx.ServerError("The file has not been decompressed completely now", errors.New("The file has not been decompressed completely now")) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// ctx.Data["OriginName"] = attachment.Name |
|
|
|
dirArray = append([]string{attachment.Name}, dirArray...) |
|
|
|
if parentDir == "" { |
|
|
|
dirArray = []string{attachment.Name} |
|
|
|
} |
|
|
|
|
|
|
|
files, err := ioutil.ReadDir(setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.Attachment.Minio.BasePath + |
|
|
|