mirror of
https://github.com/OpenMaxIO/openmaxio-object-browser
synced 2026-07-01 07:41:18 -07:00
Fix sanitize file path while drag and drop (#3492)
This commit is contained in:
committed by
GitHub
parent
656d8075b2
commit
4388ecc4eb
@@ -122,6 +122,7 @@ import TooltipWrapper from "../../../../Common/TooltipWrapper/TooltipWrapper";
|
|||||||
import ListObjectsTable from "./ListObjectsTable";
|
import ListObjectsTable from "./ListObjectsTable";
|
||||||
import FilterObjectsSB from "../../../../ObjectBrowser/FilterObjectsSB";
|
import FilterObjectsSB from "../../../../ObjectBrowser/FilterObjectsSB";
|
||||||
import AddAccessRule from "../../../BucketDetails/AddAccessRule";
|
import AddAccessRule from "../../../BucketDetails/AddAccessRule";
|
||||||
|
import { sanitizeFilePath } from "./utils";
|
||||||
|
|
||||||
const DeleteMultipleObjects = withSuspense(
|
const DeleteMultipleObjects = withSuspense(
|
||||||
React.lazy(() => import("./DeleteMultipleObjects")),
|
React.lazy(() => import("./DeleteMultipleObjects")),
|
||||||
@@ -506,7 +507,7 @@ const ListObjects = () => {
|
|||||||
|
|
||||||
const blobFile = new Blob([file], { type: file.type });
|
const blobFile = new Blob([file], { type: file.type });
|
||||||
|
|
||||||
const filePath = get(file, "path", "");
|
const filePath = sanitizeFilePath(get(file, "path", ""));
|
||||||
const fileWebkitRelativePath = get(file, "webkitRelativePath", "");
|
const fileWebkitRelativePath = get(file, "webkitRelativePath", "");
|
||||||
|
|
||||||
let relativeFolderPath = folderPath;
|
let relativeFolderPath = folderPath;
|
||||||
|
|||||||
@@ -134,3 +134,8 @@ export const displayFileIconName = (
|
|||||||
|
|
||||||
return <IconWithLabel icon={icon} strings={splitItem} />;
|
return <IconWithLabel icon={icon} strings={splitItem} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const sanitizeFilePath = (filePath: string) => {
|
||||||
|
// Replace `./` at the start of the path or preceded by `/` - happens when drag drop upload of files (not folders !) in chrome
|
||||||
|
return filePath.replace(/(^|\/)\.\//g, "/");
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user