Skip to content

Commit 0ec6285

Browse files
authored
Merge branch 'master' into fs_support
2 parents cab51c1 + c31af8b commit 0ec6285

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/DeleteObject.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ const DeleteObject = ({
5353
if (selectedObject.endsWith("/")) {
5454
recursive = true;
5555
}
56-
setDeleteLoading(true);
56+
// Escape object name
57+
selectedObject = encodeURIComponent(selectedObject);
58+
5759
api
5860
.invoke(
5961
"DELETE",

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/ListObjects.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ const ListObjects = ({
468468
let files = e.target.files;
469469
let uploadUrl = `/api/v1/buckets/${bucketName}/objects/upload`;
470470
if (path !== "") {
471-
uploadUrl = `${uploadUrl}?prefix=${path}`;
471+
const encodedPath = encodeURIComponent(path);
472+
uploadUrl = `${uploadUrl}?prefix=${encodedPath}`;
472473
}
473474
let xhr = new XMLHttpRequest();
474475
const areMultipleFiles = files.length > 1 ? true : false;

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/ObjectDetails.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,11 @@ const ObjectDetails = ({
219219

220220
useEffect(() => {
221221
if (loadObjectData) {
222+
const encodedPath = encodeURIComponent(pathInBucket);
222223
api
223224
.invoke(
224225
"GET",
225-
`/api/v1/buckets/${bucketName}/objects?prefix=${pathInBucket}${
226+
`/api/v1/buckets/${bucketName}/objects?prefix=${encodedPath}${
226227
distributedSetup ? "&with_versions=true" : ""
227228
}`
228229
)

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export const download = (
2525
) => {
2626
const anchor = document.createElement("a");
2727
document.body.appendChild(anchor);
28-
29-
let path = `/api/v1/buckets/${bucketName}/objects/download?prefix=${objectPath}`;
28+
const encodedPath = encodeURIComponent(objectPath);
29+
let path = `/api/v1/buckets/${bucketName}/objects/download?prefix=${encodedPath}`;
3030
if (!isNullOrUndefined(versionID) && versionID !== "null") {
3131
path = path.concat(`&version_id=${versionID}`);
3232
}

portal-ui/src/screens/Console/Policies/PolicyDetails.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import TableWrapper from "../Common/TableWrapper/TableWrapper";
3030
import api from "../../../common/api";
3131
import PageHeader from "../Common/PageHeader/PageHeader";
3232
import { Link } from "react-router-dom";
33-
import { setErrorSnackMessage } from "../../../actions";
33+
import { setErrorSnackMessage, setSnackBarMessage } from "../../../actions";
3434
import CodeMirrorWrapper from "../Common/FormComponents/CodeMirrorWrapper/CodeMirrorWrapper";
3535
import history from "../../../history";
3636
import InputAdornment from "@material-ui/core/InputAdornment";
@@ -44,8 +44,8 @@ import TextField from "@material-ui/core/TextField";
4444
interface IPolicyDetailsProps {
4545
classes: any;
4646
match: any;
47-
closeModalAndRefresh: (refresh: boolean) => void;
4847
setErrorSnackMessage: typeof setErrorSnackMessage;
48+
setSnackBarMessage: typeof setSnackBarMessage;
4949
}
5050

5151
const styles = (theme: Theme) =>
@@ -160,8 +160,8 @@ const styles = (theme: Theme) =>
160160
const PolicyDetails = ({
161161
classes,
162162
match,
163-
closeModalAndRefresh,
164163
setErrorSnackMessage,
164+
setSnackBarMessage,
165165
}: IPolicyDetailsProps) => {
166166
const [selectedTab, setSelectedTab] = useState<number>(0);
167167
const [policy, setPolicy] = useState<Policy | null>(null);
@@ -191,7 +191,7 @@ const PolicyDetails = ({
191191
})
192192
.then((res) => {
193193
setAddLoading(false);
194-
closeModalAndRefresh(true);
194+
setSnackBarMessage("Policy successfully updated")
195195
})
196196
.catch((err) => {
197197
setAddLoading(false);
@@ -441,6 +441,7 @@ const PolicyDetails = ({
441441

442442
const connector = connect(null, {
443443
setErrorSnackMessage,
444+
setSnackBarMessage
444445
});
445446

446447
export default withStyles(styles)(connector(PolicyDetails));

0 commit comments

Comments
 (0)