Skip to content

Commit 6d8b276

Browse files
authored
BUGFIX: Artist page doesn't decode URL fields (#18)
* BUGFIX: Artist page doesn't decode URL fields The frontend url-encodes ID3 tags to safely use them in URLs. So the artist page for "The Beatles" is `/web/artist/The%20Beatles`. For encoded fields with non-trivial characters (comma, ampersand), the browser or url router won't automatically decode those values. So `Emerson, Lake & Palmer` (`Emerson%2C%20Lake%20%26%20Palmer`) ended up as `Emerson%2C Lake %26 Palmer` in the frontend memory, which will match with nothing when searched for in MPD. The fix is to include a decode step in the render step of the Artist page so that it queries the MPD backend with the correct value. * spaces * whoops
1 parent 6c7cbcc commit 6d8b276

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

web/src/ArtistPage/Component.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { albumListFromData } from "../mpd";
88
import urls from "../urls";
99

1010
export default function ArtistPage(props) {
11-
const { artist, history } = props;
11+
const { artist: artistUnDecoded, history } = props;
12+
const artist = decodeURIComponent(artistUnDecoded);
1213
const { data, loaded, err } = useMPDQuery(`find albumartist "${artist}"`);
1314
const [show, _] = React.useState(false);
1415

0 commit comments

Comments
 (0)