Fix bug when deleting objects with % in the name (#876)
* Fix bug when deleting object puts with % in the name Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> * Remove unused import Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -53,7 +53,9 @@ const DeleteObject = ({
|
||||
if (selectedObject.endsWith("/")) {
|
||||
recursive = true;
|
||||
}
|
||||
setDeleteLoading(true);
|
||||
// Escape object name
|
||||
selectedObject = encodeURIComponent(selectedObject);
|
||||
|
||||
api
|
||||
.invoke(
|
||||
"DELETE",
|
||||
|
||||
@@ -468,7 +468,8 @@ const ListObjects = ({
|
||||
let files = e.target.files;
|
||||
let uploadUrl = `/api/v1/buckets/${bucketName}/objects/upload`;
|
||||
if (path !== "") {
|
||||
uploadUrl = `${uploadUrl}?prefix=${path}`;
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
uploadUrl = `${uploadUrl}?prefix=${encodedPath}`;
|
||||
}
|
||||
let xhr = new XMLHttpRequest();
|
||||
const areMultipleFiles = files.length > 1 ? true : false;
|
||||
|
||||
@@ -219,10 +219,11 @@ const ObjectDetails = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (loadObjectData) {
|
||||
const encodedPath = encodeURIComponent(pathInBucket);
|
||||
api
|
||||
.invoke(
|
||||
"GET",
|
||||
`/api/v1/buckets/${bucketName}/objects?prefix=${pathInBucket}&with_versions=true`
|
||||
`/api/v1/buckets/${bucketName}/objects?prefix=${encodedPath}&with_versions=true`
|
||||
)
|
||||
.then((res: IFileInfo[]) => {
|
||||
const result = get(res, "objects", []);
|
||||
|
||||
@@ -25,9 +25,8 @@ export const download = (
|
||||
) => {
|
||||
const anchor = document.createElement("a");
|
||||
document.body.appendChild(anchor);
|
||||
const allPathData = objectPath.split("/");
|
||||
|
||||
let path = `/api/v1/buckets/${bucketName}/objects/download?prefix=${objectPath}`;
|
||||
const encodedPath = encodeURIComponent(objectPath);
|
||||
let path = `/api/v1/buckets/${bucketName}/objects/download?prefix=${encodedPath}`;
|
||||
if (!isNullOrUndefined(versionID) && versionID !== "null") {
|
||||
path = path.concat(`&version_id=${versionID}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user