fix: suggested apps breaking (#2343)

This commit is contained in:
Daniel Salazar
2026-01-26 10:17:48 -08:00
committed by GitHub
parent 70454521ef
commit 66a3af69c9
2 changed files with 6 additions and 7 deletions
+4 -4
View File
@@ -22,7 +22,7 @@ const FSNodeParam = require('../api/filesystem/FSNodeParam.js');
const { Context } = require('../util/context.js');
const { UserActorType } = require('../services/auth/Actor.js');
const APIError = require('../api/APIError.js');
const { sign_file, suggest_app_for_fsentry, get_app } = require('../helpers.js');
const { sign_file, suggestedAppForFsEntry, get_app } = require('../helpers.js');
// -----------------------------------------------------------------------//
// POST /open_item
@@ -37,7 +37,7 @@ module.exports = eggspress('/open_item', {
parameters: {
subject: new FSNodeParam('path'),
},
}, async (req, res, next) => {
}, async (req, res) => {
const subject = req.values.subject;
const actor = Context.get('actor');
@@ -60,13 +60,13 @@ module.exports = eggspress('/open_item', {
}
const signature = await sign_file(subject.entry, action);
const suggested_apps = await suggest_app_for_fsentry(subject.entry);
const suggested_apps = await suggestedAppForFsEntry(subject.entry);
const apps_only_one = suggested_apps.slice(0, 1);
const _app = apps_only_one[0];
if ( ! _app ) {
throw APIError.create('no_suitable_app', null, { entry_name: subject.entry.name });
}
const app = await get_app(_app.hasOwnProperty('id')
const app = await get_app(Object.prototype.hasOwnProperty.call(_app, 'id')
? { id: _app.id }
: { uid: _app.uid }) ?? apps_only_one[0];
+2 -3
View File
@@ -23,6 +23,7 @@ const auth = require('../middleware/auth.js');
const config = require('../config');
const { Context } = require('../util/context.js');
const { NodeInternalIDSelector } = require('../filesystem/node/selectors.js');
const { convert_path_to_fsentry, uuid2fsentry, suggestedAppForFsEntry } = require('../helpers');
// -----------------------------------------------------------------------//
// POST /suggest_apps
@@ -46,8 +47,6 @@ router.post('/suggest_apps', auth, express.json(), async (req, res, next) => {
return res.status(400).send({ message: '`uid` or `path` required' });
}
// modules
const { convert_path_to_fsentry, uuid2fsentry, suggest_app_for_fsentry } = require('../helpers');
let fsentry;
// by uid
@@ -84,7 +83,7 @@ router.post('/suggest_apps', auth, express.json(), async (req, res, next) => {
// get suggestions
try {
return res.send(await suggest_app_for_fsentry(fsentry));
return res.send(await suggestedAppForFsEntry(fsentry));
}
catch (e) {
return res.status(400).send(e);