Skip to content

Commit

Permalink
add encoded filename as part of delete url for tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
prakashsvmx committed Dec 1, 2023
1 parent 290f273 commit 94aacad
Showing 1 changed file with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { hasPermission } from "../../../../../../common/SecureComponent";
import { IAM_SCOPES } from "../../../../../../common/SecureComponent/permissions";
import { useSelector } from "react-redux";
import { BucketVersioningResponse } from "api/consoleApi";
import { encodeURLString } from "../../../../../../common/utils";

interface IDeleteObjectProps {
closeDeleteModalAndRefresh: (refresh: boolean) => void;
Expand Down Expand Up @@ -85,14 +86,26 @@ const DeleteObject = ({
}
}

const toolingParams: Record<any, any> = {
...(selectedObjects.length === 1 && {
fileName: encodeURLString(selectedObjects[0]),
}),
...(selectedObjects.length > 1 && {
multiple: true,
count: selectedObjects.length,
}),
};

if (toSend) {
invokeDeleteApi(
"POST",
`/api/v1/buckets/${selectedBucket}/delete-objects?all_versions=${deleteVersions}${
bypassGovernance ? "&bypass=true" : ""
}`,
toSend,
);
let delUrl = `/api/v1/buckets/${selectedBucket}/delete-objects?all_versions=${deleteVersions}${
bypassGovernance ? "&bypass=true" : ""
}`;

const tQryParams = new URLSearchParams(toolingParams).toString();

delUrl = `${delUrl}&${tQryParams}`;

invokeDeleteApi("POST", delUrl, toSend);
}
};

Expand Down

0 comments on commit 94aacad

Please sign in to comment.