Skip to content

Commit

Permalink
Not show objects with the same path (#1784)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
  • Loading branch information
bexsoft authored Mar 31, 2022
1 parent 461bc94 commit 1985c11
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,12 @@ const ListObjects = ({
.then((res: RewindObjectList) => {
setLoadingRewind(false);
if (res.objects) {
setRewind(res.objects);
// We omit files from the same path
const filteredObjects = res.objects.filter((object) => {
return object.name !== decodeFileName(internalPaths)
})

setRewind(filteredObjects);
} else {
setRewind([]);
}
Expand Down Expand Up @@ -558,12 +563,15 @@ const ListObjects = ({
const files: BucketObject[] = [];

records.forEach((record) => {
// this is a folder
if (record.name.endsWith("/")) {
folders.push(record);
} else {
// this is a file
files.push(record);
// We omit files from the same path
if (record.name !== decodeFileName(internalPaths)) {
// this is a folder
if (record.name.endsWith("/")) {
folders.push(record);
} else {
// this is a file
files.push(record);
}
}
});
const recordsInElement = [...folders, ...files];
Expand Down Expand Up @@ -1051,7 +1059,6 @@ const ListObjects = ({
const currentPath = pageTitle.split("/").filter((i: string) => i !== "");

const plSelect = rewindEnabled ? rewind : filteredRecords;

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

let payload: BucketObject[] | RewindObject[] = [];
Expand Down

0 comments on commit 1985c11

Please sign in to comment.