fix: ensure proper encoding of folder paths in navigation links
- Updated folder path handling in the FolderViewerPage, SidebarContent, and VirtualizedFolderGrid components to use encodeURIComponent for URL encoding. - This change improves the handling of special characters in folder paths, ensuring correct navigation and link generation.
This commit is contained in:
parent
fbeed219fc
commit
b93bd26825
|
|
@ -123,7 +123,7 @@ const FolderViewerPage = () => {
|
||||||
const handleBackClick = () => {
|
const handleBackClick = () => {
|
||||||
const parentPath = getParentPath(path || '');
|
const parentPath = getParentPath(path || '');
|
||||||
if (parentPath) {
|
if (parentPath) {
|
||||||
router.push(`/folder-viewer?path=${parentPath}`);
|
router.push(`/folder-viewer?path=${encodeURIComponent(parentPath)}`);
|
||||||
} else {
|
} else {
|
||||||
router.push('/folder-viewer');
|
router.push('/folder-viewer');
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +133,7 @@ const FolderViewerPage = () => {
|
||||||
if (breadcrumbPath === '') {
|
if (breadcrumbPath === '') {
|
||||||
router.push('/folder-viewer');
|
router.push('/folder-viewer');
|
||||||
} else {
|
} else {
|
||||||
router.push(`/folder-viewer?path=${breadcrumbPath}`);
|
router.push(`/folder-viewer?path=${encodeURIComponent(breadcrumbPath)}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ const SidebarContent = () => {
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
{libraries.map((lib) => (
|
{libraries.map((lib) => (
|
||||||
<Link
|
<Link
|
||||||
href={`/folder-viewer?path=${lib.path}`}
|
href={`/folder-viewer?path=${encodeURIComponent(lib.path)}`}
|
||||||
key={lib.id}
|
key={lib.id}
|
||||||
passHref
|
passHref
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ export default function VirtualizedFolderGrid({
|
||||||
return (
|
return (
|
||||||
<div style={style} className="p-2">
|
<div style={style} className="p-2">
|
||||||
<div className={`group relative bg-white dark:bg-slate-800 rounded-xl shadow-sm hover:shadow-lg transition-all duration-300 hover:-translate-y-1 overflow-hidden min-h-[240px] ${(item.type === 'video' || item.type === 'photo' || item.type === 'text') ? 'cursor-pointer' : ''}`}>
|
<div className={`group relative bg-white dark:bg-slate-800 rounded-xl shadow-sm hover:shadow-lg transition-all duration-300 hover:-translate-y-1 overflow-hidden min-h-[240px] ${(item.type === 'video' || item.type === 'photo' || item.type === 'text') ? 'cursor-pointer' : ''}`}>
|
||||||
<Link href={item.isDirectory ? `/folder-viewer?path=${item.path}` : '#'}
|
<Link href={item.isDirectory ? `/folder-viewer?path=${encodeURIComponent(item.path)}` : '#'}
|
||||||
className="block h-full flex flex-col"
|
className="block h-full flex flex-col"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (item.type === 'video' && item.id) {
|
if (item.type === 'video' && item.id) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue