Web: Editor: fixed goBack

This commit is contained in:
Nikita Gopienko 2023-07-25 18:27:43 +03:00
parent a1a2d5aa4a
commit f4e2f76fff
2 changed files with 8 additions and 2 deletions

View File

@ -25,8 +25,8 @@ const PublicRoom = (props) => {
const navigate = useNavigate();
const location = useLocation();
const lastKeySymbol = location.search.indexOf("&");
const lastKeySymbol = location.search.indexOf("&");
const lastIndex =
lastKeySymbol === -1 ? location.search.length : lastKeySymbol;
const key = location.search.substring(5, lastIndex);

View File

@ -605,12 +605,18 @@ function Editor({
let goBack;
const url = window.location.href;
const search = window.location.search;
const shareIndex = search.indexOf("share=");
const key = search.substring(shareIndex + 6);
if (fileInfo) {
let backUrl = "";
if (fileInfo.rootFolderType === FolderType.Rooms) {
backUrl = `/rooms/shared/${fileInfo.folderId}/filter?folder=${fileInfo.folderId}`;
if (key) {
backUrl = `/rooms/share?key=${key}`;
} else {
backUrl = `/rooms/shared/${fileInfo.folderId}/filter?folder=${fileInfo.folderId}`;
}
} else {
backUrl = `/rooms/personal/filter?folder=${fileInfo.folderId}`;
}