Blank 'albums' view of search results
Steps to reproduce
- Install Funkwhale 1.3.2
- Search for something
- Click on the "Albums" view
Expected results
The list of albums appears.
Actual results
The UI to the right of the sidebar is blank.
More info
A TypeError appears in Developer Tools:
E$ useLogger.ts:49
ic useLogger.ts:61
R Search.vue:215
run reactivity.esm-bundler.js:187
The line of code in question:
const getFile = () => {
const { stack } = new Error()
const line = stack?.split('\n')[2] ?? ''
const [, method, url, lineNo] = line.match(/^(\w+)?(?:\/<)*@(.+?)(?:\?.*)?:(\d+):\d+$/) ?? []
const file = url.startsWith(location.origin) ? url.slice(location.origin.length) : url # <= TypeError: url is undefined
return { method, file, lineNo }
}
Note the nullish coalescing with []
that is destructured with an array binding, implying url
can be undefined
, but the next line uses it unconditionally.
In this case, line
was "setup/R<@https://funkwhale.example.com/assets/Search-b434d2d2.js:1:4529"
, which doesn't match. The RegExp matches up to setup/
, but it expects no characters between the /
and <
.
Inserting a \w*
before t seems to fix it:
/^(\w+)?(?:\/\w*<)*@(.+?)(?:\?.*)?:(\d+):\d+$/
Could just be my environment, but I'm not sure what I did to cause the function names to differ like this.
Edit: this is on Firefox, and there are a few different patterns like vs</m/<@https://funkwhale.example.com/assets/index-18fb97c6.js:30:99569
so my first stab at it didn't work.
If the intent is to get the part before the first slash, then this would work:
/^([^@/]*)(?:[^@]*)?@(.+?)(?:\?.*)?:(\d+):\d+$/