From 94aacad8ef03bcbe4f3f7f85e5a7909a4556f145 Mon Sep 17 00:00:00 2001 From: prakashsvmx Date: Fri, 1 Dec 2023 17:36:29 +0530 Subject: [PATCH] add encoded filename as part of delete url for tooling --- .../ListObjects/DeleteMultipleObjects.tsx | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/DeleteMultipleObjects.tsx b/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/DeleteMultipleObjects.tsx index af09467e1e..35a6d5a76e 100644 --- a/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/DeleteMultipleObjects.tsx +++ b/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/DeleteMultipleObjects.tsx @@ -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; @@ -85,14 +86,26 @@ const DeleteObject = ({ } } + const toolingParams: Record = { + ...(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); } };