server: Add recursion limit to resolver #261

Merged
norm merged 3 commits from recursion-limit into main 2022-12-01 20:11:41 +00:00
Showing only changes of commit 936cbf900b - Show all commits

View file

@ -39,7 +39,7 @@ export async function extractPollFromQuestion(source: string | IObject, resolver
* @param resolver Resolver to use
* @returns true if updated
*/
export async function updateQuestion(value: string | IObject, resolver?: Resolver) {
export async function updateQuestion(value: string | IObject, resolver?: Resolver = new Resolver()) {
const uri = typeof value === 'string' ? value : value.id;
// URIがこのサーバーを指しているならスキップ
@ -54,7 +54,6 @@ export async function updateQuestion(value: string | IObject, resolver?: Resolve
//#endregion
// resolve new Question object
if (resolver == null) resolver = new Resolver();
const question = await resolver.resolve(value) as IQuestion;
apLogger.debug(`fetched question: ${JSON.stringify(question, null, 2)}`);