fix browser hang when listobjects is denied (#6385)

When Deny ListObjects policy is set on bucket, the browser
is hanging while trying to list the object. This is now
fixed by showing appropriate error message and an
empty object list.

Fixes #6371
This commit is contained in:
Kanagaraj Mayilsamy
2018-09-05 01:32:02 +05:30
committed by kannappanr
parent d13bd5b9b5
commit 2c46214291
4 changed files with 126 additions and 37 deletions

View File

@@ -24,9 +24,11 @@ import {
import { getCurrentBucket } from "../buckets/selectors"
import { getCurrentPrefix, getCheckedList } from "./selectors"
import * as alertActions from "../alert/actions"
import * as bucketActions from "../buckets/actions"
import { minioBrowserPrefix } from "../constants"
export const SET_LIST = "objects/SET_LIST"
export const RESET_LIST = "object/RESET_LIST"
export const APPEND_LIST = "objects/APPEND_LIST"
export const REMOVE = "objects/REMOVE"
export const SET_SORT_BY = "objects/SET_SORT_BY"
@@ -45,6 +47,10 @@ export const setList = (objects, marker, isTruncated) => ({
isTruncated
})
export const resetList = () => ({
type: RESET_LIST
})
export const appendList = (objects, marker, isTruncated) => ({
type: APPEND_LIST,
objects,
@@ -58,6 +64,7 @@ export const fetchObjects = append => {
buckets: { currentBucket },
objects: { currentPrefix, marker }
} = getState()
dispatch(alertActions.clear())
if (currentBucket) {
return web
.ListObjects({
@@ -85,8 +92,13 @@ export const fetchObjects = append => {
dispatch(setPrefixWritable(res.writable))
})
.catch(err => {
dispatch(alertActions.set({ type: "danger", message: err.message }))
history.push("/login")
if (web.LoggedIn()) {
dispatch(alertActions.set({ type: "danger", message: err.message }))
dispatch(resetList())
}
else {
history.push("/login")
}
})
}
}