mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Performer/Studio/Tag/Gallery Create compnent has default name as search query (#2701)
* feat: Closes #2618 fix: New button is now available even if pathname ends with '/'
This commit is contained in:
@@ -217,8 +217,14 @@ export const MainNavbar: React.FC = () => {
|
||||
[history]
|
||||
);
|
||||
|
||||
const { pathname } = location;
|
||||
const newPath = newPathsList.includes(pathname) ? `${pathname}/new` : null;
|
||||
const pathname = location.pathname.replace(/\/$/, "");
|
||||
let newPath = newPathsList.includes(pathname) ? `${pathname}/new` : null;
|
||||
if (newPath != null) {
|
||||
let queryParam = new URLSearchParams(location.search).get("q");
|
||||
if (queryParam != null) {
|
||||
newPath += "?name=" + encodeURIComponent(queryParam);
|
||||
}
|
||||
}
|
||||
|
||||
// set up hotkeys
|
||||
useEffect(() => {
|
||||
@@ -230,7 +236,7 @@ export const MainNavbar: React.FC = () => {
|
||||
);
|
||||
|
||||
if (newPath) {
|
||||
Mousetrap.bind("n", () => history.push(newPath));
|
||||
Mousetrap.bind("n", () => history.push(String(newPath)));
|
||||
}
|
||||
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user