Skip to content

fix(taskprocessing): skip absent optional file slots in prepareTask - #65785

Open
WSHAPER wants to merge 1 commit into
nextcloud:masterfrom
WSHAPER:fix/taskprocessing-optional-file-slot
Open

WSHAPER wants to merge 1 commit into
nextcloud:masterfrom
WSHAPER:fix/taskprocessing-optional-file-slot

Conversation

@WSHAPER

@WSHAPER WSHAPER commented Oct 22, 2026

Copy link
Copy Markdown

Summary

Any app declaring an optional File or ListOfFiles input breaks scheduling for every caller that omits the slot: the Assistant form omits unfilled optional fields, so this is the common path. The server resolves the missing key to null and feeds it to file resolution as an id. prepareTask then crashes with a TypeError and the schedule request fails with HTTP 500.

Changes

prepareTask now skips an optional file input slot that resolves to null instead of collecting it as a file id, so a task whose optional File/ListOfFiles slot is omitted schedules normally. Slots that are provided are validated as before.

Steps to reproduce (before this change)

  1. Schedule a task type that declares an optional File or ListOfFiles input slot.
  2. Omit the optional slot.
  3. The schedule request fails with HTTP 500: the missing key resolves to null and is passed to getFirstNodeById as a file id, which only accepts int.

With this change the same request returns a scheduled task.

Tests

TaskProcessingTest::testScheduleTaskWithOmittedOptionalFileInput schedules a task type with an optional File input slot, omits the slot, and expects the task to reach STATUS_SCHEDULED.

References #60218

Cross-references

Assisted by opencode with zai/glm-5.3, reviewed by WSHAPER

An optional File/ListOfFiles input slot that the caller omits resolves to
null in the file id collection loop; the null is collected as a file id
and passed to getFirstNodeById, which only accepts int, so prepareTask
crashes with a TypeError and the schedule request fails with HTTP 500.
Skip the slot when it resolves to null so the task schedules normally.

Signed-off-by: WSHAPER <42714629+WSHAPER@users.noreply.github.com>

Assisted-by: opencode (zai/glm-5.3)
@WSHAPER
WSHAPER requested a review from a team as a code owner October 22, 2026 09:06
@WSHAPER
WSHAPER requested review from Altahrim, icewind1991, leftybournes and salmart-dev and removed request for a team October 22, 2026 09:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant