Skip to content

Commit 6900233

Browse files
committed
fix: Remove null or duplicate app entries from suggest_app_for_fsentry()
1 parent c55b1e4 commit 6900233

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/backend/src/helpers.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,15 @@ async function suggest_app_for_fsentry(fsentry, options){
17701770
monitor.end();
17711771

17721772
// return list
1773-
return suggested_apps;
1773+
return suggested_apps.filter((suggested_app, pos, self) => {
1774+
// Remove any null values caused by calling `get_app()` for apps that don't exist.
1775+
// This happens on self-host because we don't include `code`, among others.
1776+
if (!suggested_app)
1777+
return false;
1778+
1779+
// Remove any duplicate entries
1780+
return self.indexOf(suggested_app) === pos;
1781+
});
17741782
}
17751783

17761784
function build_item_object(item){

0 commit comments

Comments
 (0)