Fixed incompatibility with some base64 strings & React Router v6 (#2208)
* Fixed incompatibility with some base64 strings & React Router v6 This affected Object Browser & certain Cyrillic / Chinese names Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -16,12 +16,11 @@
|
|||||||
|
|
||||||
import React, { Fragment, useEffect } from "react";
|
import React, { Fragment, useEffect } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
||||||
import { Theme } from "@mui/material/styles";
|
import { Theme } from "@mui/material/styles";
|
||||||
import createStyles from "@mui/styles/createStyles";
|
import createStyles from "@mui/styles/createStyles";
|
||||||
import withStyles from "@mui/styles/withStyles";
|
import withStyles from "@mui/styles/withStyles";
|
||||||
import { Grid, IconButton, Tooltip } from "@mui/material";
|
import { Grid, IconButton, Tooltip } from "@mui/material";
|
||||||
import get from "lodash/get";
|
|
||||||
import { AppState, useAppDispatch } from "../../../../store";
|
import { AppState, useAppDispatch } from "../../../../store";
|
||||||
import { containerForHeader } from "../../Common/FormComponents/common/styleLibrary";
|
import { containerForHeader } from "../../Common/FormComponents/common/styleLibrary";
|
||||||
|
|
||||||
@@ -55,6 +54,7 @@ const BrowserHandler = () => {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
const versionsMode = useSelector(
|
const versionsMode = useSelector(
|
||||||
(state: AppState) => state.objectBrowser.versionsMode
|
(state: AppState) => state.objectBrowser.versionsMode
|
||||||
@@ -72,7 +72,9 @@ const BrowserHandler = () => {
|
|||||||
const features = useSelector(selFeatures);
|
const features = useSelector(selFeatures);
|
||||||
|
|
||||||
const bucketName = params.bucketName || "";
|
const bucketName = params.bucketName || "";
|
||||||
const internalPaths = get(params, "subpaths", "");
|
const pathSegment = location.pathname.split("/browse/");
|
||||||
|
|
||||||
|
const internalPaths = pathSegment.length === 2 ? pathSegment[1] : "";
|
||||||
|
|
||||||
const obOnly = !!features?.includes("object-browser-only");
|
const obOnly = !!features?.includes("object-browser-only");
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ const Buckets = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path=":bucketName/browse/:subpaths"
|
path=":bucketName/browse/*"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<LoadingComponent />}>
|
<Suspense fallback={<LoadingComponent />}>
|
||||||
<BrowserHandler />
|
<BrowserHandler />
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import React, {
|
|||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
import { Theme } from "@mui/material/styles";
|
import { Theme } from "@mui/material/styles";
|
||||||
import createStyles from "@mui/styles/createStyles";
|
import createStyles from "@mui/styles/createStyles";
|
||||||
@@ -275,6 +275,7 @@ const ListObjects = () => {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
const rewindEnabled = useSelector(
|
const rewindEnabled = useSelector(
|
||||||
(state: AppState) => state.objectBrowser.rewind.rewindEnabled
|
(state: AppState) => state.objectBrowser.rewind.rewindEnabled
|
||||||
@@ -340,7 +341,9 @@ const ListObjects = () => {
|
|||||||
const [downloadRenameModal, setDownloadRenameModal] =
|
const [downloadRenameModal, setDownloadRenameModal] =
|
||||||
useState<BucketObjectItem | null>(null);
|
useState<BucketObjectItem | null>(null);
|
||||||
|
|
||||||
const internalPaths = get(params, "subpaths", "");
|
const pathSegment = location.pathname.split("/browse/");
|
||||||
|
|
||||||
|
const internalPaths = pathSegment.length === 2 ? pathSegment[1] : "";
|
||||||
const bucketName = params.bucketName || "";
|
const bucketName = params.bucketName || "";
|
||||||
|
|
||||||
const fileUpload = useRef<HTMLInputElement>(null);
|
const fileUpload = useRef<HTMLInputElement>(null);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ test
|
|||||||
const uploadButton = elements.uploadButton;
|
const uploadButton = elements.uploadButton;
|
||||||
await t
|
await t
|
||||||
.useRole(roles.bucketWritePrefixOnly)
|
.useRole(roles.bucketWritePrefixOnly)
|
||||||
.navigateTo("http://localhost:9090/buckets/testcafe/browse/d3JpdGU=/")
|
.navigateTo("http://localhost:9090/buckets/testcafe/browse/d3JpdGU=")
|
||||||
.click(uploadButton)
|
.click(uploadButton)
|
||||||
.expect(Selector("li").withText("Upload File").hasClass("Mui-disabled"))
|
.expect(Selector("li").withText("Upload File").hasClass("Mui-disabled"))
|
||||||
.notOk()
|
.notOk()
|
||||||
|
|||||||
Reference in New Issue
Block a user