File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
web-app/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ import TooltipWrapper from "../../../../Common/TooltipWrapper/TooltipWrapper";
122122import ListObjectsTable from "./ListObjectsTable" ;
123123import FilterObjectsSB from "../../../../ObjectBrowser/FilterObjectsSB" ;
124124import AddAccessRule from "../../../BucketDetails/AddAccessRule" ;
125+ import { sanitizeFilePath } from "./utils" ;
125126
126127const DeleteMultipleObjects = withSuspense (
127128 React . lazy ( ( ) => import ( "./DeleteMultipleObjects" ) ) ,
@@ -506,7 +507,7 @@ const ListObjects = () => {
506507
507508 const blobFile = new Blob ( [ file ] , { type : file . type } ) ;
508509
509- const filePath = get ( file , "path" , "" ) ;
510+ const filePath = sanitizeFilePath ( get ( file , "path" , "" ) ) ;
510511 const fileWebkitRelativePath = get ( file , "webkitRelativePath" , "" ) ;
511512
512513 let relativeFolderPath = folderPath ;
Original file line number Diff line number Diff line change @@ -134,3 +134,8 @@ export const displayFileIconName = (
134134
135135 return < IconWithLabel icon = { icon } strings = { splitItem } /> ;
136136} ;
137+
138+ export const sanitizeFilePath = ( filePath : string ) => {
139+ // Replace `./` at the start of the path or preceded by `/` - happens when drag drop upload of files (not folders !) in chrome
140+ return filePath . replace ( / ( ^ | \/ ) \. \/ / g, "/" ) ;
141+ } ;
You can’t perform that action at this time.
0 commit comments