Browse URI + name syntax, fixes #829
This commit is contained in:
@ -28,8 +28,12 @@ export default ({
|
||||
break;
|
||||
|
||||
case 'browse':
|
||||
let directory = '';
|
||||
if (uri.indexOf('file://')) {
|
||||
directory = uri.substr(uri.lastIndexOf('/'), uri.length);
|
||||
}
|
||||
link = (
|
||||
<URILink type={type} uri={uri}>
|
||||
<URILink type={type} uri={uri} suffix={directory}>
|
||||
<I18n path="library.browse.title" />
|
||||
</URILink>
|
||||
);
|
||||
|
||||
@ -10,6 +10,7 @@ export default memo(({
|
||||
handleContextMenu,
|
||||
children,
|
||||
unencoded,
|
||||
suffix,
|
||||
}) => {
|
||||
let to = null;
|
||||
const uriType = type || uriTypeHelper(rawUri);
|
||||
@ -37,7 +38,7 @@ export default memo(({
|
||||
break;
|
||||
|
||||
case 'browse':
|
||||
to = `/library/browse/${uri}`;
|
||||
to = `/library/browse/${uri}${suffix ? `/${suffix}` : ''}`;
|
||||
break;
|
||||
|
||||
case 'recommendations':
|
||||
|
||||
@ -124,7 +124,7 @@ class Browse extends React.Component {
|
||||
|
||||
grid_items.push({
|
||||
name: subdirectory.name,
|
||||
link: `/library/browse/${encodeURIComponent(subdirectory.name)}/${encodeUri(subdirectory.uri)}`,
|
||||
link: `/library/browse/${encodeUri(subdirectory.uri)}/${encodeURIComponent(subdirectory.name)}`,
|
||||
icons: formatImages(subdirectory.icons),
|
||||
});
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ const Subdirectories = ({ items, view }) => {
|
||||
// Only define the link for directories; allows URILink to intelligently route based on type
|
||||
const link = (item) => (
|
||||
item.type === 'directory'
|
||||
? `/library/browse/${encodeURIComponent(item.name)}/${encodeUri(item.uri)}`
|
||||
? `/library/browse/${encodeUri(item.uri)}/${encodeURIComponent(item.name)}`
|
||||
: null
|
||||
);
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ export default () => (
|
||||
element={<Browse />}
|
||||
/>
|
||||
<Route
|
||||
path="browse/:name/:uri"
|
||||
path="browse/:uri/:name"
|
||||
element={<BrowseDirectory />}
|
||||
/>
|
||||
</Routes>
|
||||
|
||||
Reference in New Issue
Block a user