refactor song path replacement

- path replacement during runtime instead of during API normalization
- fix Navidrome API path not appending libraryPath which caused inconsistency between ND and Subsonic paths
This commit is contained in:
jeffvli
2026-06-19 22:02:12 -07:00
parent 36624350f6
commit 61cc87e0b7
15 changed files with 119 additions and 398 deletions
@@ -1,3 +1,5 @@
import { ItemDetailListCellProps } from './types';
import { resolveSongPath } from '/@/renderer/utils/resolve-song-path';
export const PathColumn = ({ song }: ItemDetailListCellProps) => song.path ?? <>&nbsp;</>;
export const PathColumn = ({ song }: ItemDetailListCellProps) =>
resolveSongPath(song.path) ?? <>&nbsp;</>;
@@ -4,15 +4,17 @@ import {
ItemTableListInnerColumn,
TableColumnTextContainer,
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
import { resolveSongPath } from '/@/renderer/utils/resolve-song-path';
export const PathColumn = (props: ItemTableListInnerColumn) => {
const rowItem = props.getRowItem?.(props.rowIndex) ?? (props.data as any[])[props.rowIndex];
const row: string | undefined = (rowItem as any)?.[props.columns[props.columnIndex].id];
const resolvedPath = typeof row === 'string' ? resolveSongPath(row) : null;
if (typeof row === 'string' && row) {
if (resolvedPath) {
return (
<TableColumnTextContainer {...props}>
<span>{row}</span>
<span>{resolvedPath}</span>
</TableColumnTextContainer>
);
}