diff --git a/pkg/infra/filestorage/db_filestorage.go b/pkg/infra/filestorage/db_filestorage.go index f84f146c08a..ae1f38fc1ac 100644 --- a/pkg/infra/filestorage/db_filestorage.go +++ b/pkg/infra/filestorage/db_filestorage.go @@ -33,6 +33,11 @@ type file struct { MimeType string `xorm:"mime_type"` } +var ( + fileColsNoContents = []string{"path", "path_hash", "parent_folder_path_hash", "etag", "cache_control", "content_disposition", "updated", "created", "size", "mime_type"} + allFileCols = append([]string{"contents"}, fileColsNoContents...) +) + type fileMeta struct { PathHash string `xorm:"path_hash"` Key string `xorm:"key"` @@ -339,6 +344,12 @@ func (s dbFileStorage) List(ctx context.Context, folderPath string, paging *Pagi sess.Where("path > ?", cursor) } + if options.WithContents { + sess.Cols(allFileCols...) + } else { + sess.Cols(fileColsNoContents...) + } + if err := sess.Find(&foundFiles); err != nil { return err }