browser: Remove currentPath prefix in object names from list result. (#3750)

master
Krishna Srinivas 8 years ago committed by Harshavardhana
parent f6a9e690bf
commit ae4656e699
  1. 12
      browser/app/js/actions.js

@ -305,8 +305,12 @@ export const listObjects = () => {
})
.then(res => {
let objects = res.objects
if (!objects.length)
if (!objects)
objects = []
objects = objects.map(object => {
object.name = object.name.replace(`${currentPath}`, '');
return object
})
dispatch(setObjects(objects, res.nextmarker, res.istruncated))
dispatch(setPrefixWritable(res.writable))
dispatch(setLoadBucket(''))
@ -328,7 +332,7 @@ export const listObjects = () => {
export const selectPrefix = prefix => {
return (dispatch, getState) => {
const {currentBucket, web} = getState()
dispatch(setObjects([], "", true))
dispatch(setObjects([], "", false))
dispatch(setLoadPath(prefix))
web.ListObjects({
bucketName: currentBucket,
@ -339,6 +343,10 @@ export const selectPrefix = prefix => {
let objects = res.objects
if (!objects)
objects = []
objects = objects.map(object => {
object.name = object.name.replace(`${prefix}`, '');
return object
})
dispatch(setObjects(
objects,
res.nextmarker,

Loading…
Cancel
Save