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 parentPath = getParentPath(path || '');
|
||||
if (parentPath) {
|
||||
router.push(`/folder-viewer?path=${parentPath}`);
|
||||
router.push(`/folder-viewer?path=${encodeURIComponent(parentPath)}`);
|
||||
} else {
|
||||
router.push('/folder-viewer');
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ const FolderViewerPage = () => {
|
|||
if (breadcrumbPath === '') {
|
||||
router.push('/folder-viewer');
|
||||
} 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">
|
||||
{libraries.map((lib) => (
|
||||
<Link
|
||||
href={`/folder-viewer?path=${lib.path}`}
|
||||
href={`/folder-viewer?path=${encodeURIComponent(lib.path)}`}
|
||||
key={lib.id}
|
||||
passHref
|
||||
>
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ export default function VirtualizedFolderGrid({
|
|||
return (
|
||||
<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' : ''}`}>
|
||||
<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"
|
||||
onClick={(e) => {
|
||||
if (item.type === 'video' && item.id) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue