From ae4656e69955cd569dd70d0f417a973816b13d8d Mon Sep 17 00:00:00 2001 From: Krishna Srinivas Date: Wed, 15 Feb 2017 13:07:47 -0800 Subject: [PATCH] browser: Remove currentPath prefix in object names from list result. (#3750) --- browser/app/js/actions.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/browser/app/js/actions.js b/browser/app/js/actions.js index 2acf688e1..c9b2f72bf 100644 --- a/browser/app/js/actions.js +++ b/browser/app/js/actions.js @@ -304,9 +304,13 @@ export const listObjects = () => { marker: marker }) .then(res => { - let objects = res.objects - if (!objects.length) + let objects = res.objects + 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,