|
|
@@ -29,6 +29,7 @@ type FileInfo struct { |
|
|
|
func DirIndex(ctx *context.Context) { |
|
|
|
uuid := ctx.Params("uuid") |
|
|
|
parentDir := ctx.Query("parentDir") |
|
|
|
dirArray := strings.Split(parentDir, "/") |
|
|
|
|
|
|
|
if parentDir == "" { |
|
|
|
attachment, err := models.GetAttachmentByUUID(uuid) |
|
|
@@ -41,15 +42,13 @@ func DirIndex(ctx *context.Context) { |
|
|
|
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 |
|
|
|
} |
|
|
|
} 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["Title"] = attachment.Name |
|
|
|
// ctx.Data["OriginName"] = attachment.Name |
|
|
|
} |
|
|
|
|
|
|
|
files, err := ioutil.ReadDir(setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.Attachment.Minio.BasePath + |
|
|
@@ -87,7 +86,9 @@ func DirIndex(ctx *context.Context) { |
|
|
|
i++ |
|
|
|
} |
|
|
|
|
|
|
|
ctx.Data["Path"] = dirArray |
|
|
|
ctx.Data["Dirs"] = fileInfos |
|
|
|
ctx.Data["PageIsDataset"] = true |
|
|
|
|
|
|
|
ctx.HTML(200, tplDirIndex) |
|
|
|
} |