Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nested directory object display #3415

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions api/ws_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,23 @@ func (wsc *wsMinioClient) objectManager(session *models.Principal) {

continue
}
objItem := ObjectResponse{
Name: lsObj.Key,
Size: lsObj.Size,
LastModified: lsObj.LastModified.Format(time.RFC3339),
VersionID: lsObj.VersionID,
IsLatest: lsObj.IsLatest,
DeleteMarker: lsObj.IsDeleteMarker,
// if the key is same as requested prefix it would be nested directory object, so skip
// and show only objects under the prefix
// E.g:
// bucket/prefix1/prefix2/ -- this should be skipped from list item.
// bucket/prefix1/prefix2/an-object
// bucket/prefix1/prefix2/another-object
if messageRequest.Prefix != lsObj.Key {
objItem := ObjectResponse{
Name: lsObj.Key,
Size: lsObj.Size,
LastModified: lsObj.LastModified.Format(time.RFC3339),
VersionID: lsObj.VersionID,
IsLatest: lsObj.IsLatest,
DeleteMarker: lsObj.IsDeleteMarker,
}
buffer = append(buffer, objItem)
}
buffer = append(buffer, objItem)

if len(buffer) >= itemsPerBatch {
sendWSResponse(WSResponse{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,14 @@ const ListObjectsTable = () => {
IAM_SCOPES.S3_ALL_LIST_BUCKET,
]);

const filteredRecords = records.filter((b: BucketObjectItem) => {
const plSelect = records.filter((b: BucketObjectItem) => {
if (searchObjects === "") {
return true;
} else {
const objectName = b.name.toLowerCase();
if (objectName.indexOf(searchObjects.toLowerCase()) >= 0) {
return true;
} else {
return false;
}
return objectName.indexOf(searchObjects.toLowerCase()) >= 0;
}
});

const plSelect = filteredRecords;
const sortASC = plSelect.sort(sortListObjects(currentSortField));

let payload: BucketObjectItem[] = [];
Expand Down
Loading