Causes errrors updating files via the JSONAPI

Created on 11 November 2022, almost 2 years ago
Updated 28 September 2023, 12 months ago

Probably a pretty niche use case, but I am getting a 500 error when trying to update a file field via the JSON API when autologout is enabled.

To reproduce

Create a content type with a file upload field.
Enable the Core JSON API module.
Add content, upload a file.
Attempt to update the file with a call to the JSON endpoint request will looks something like

curl --location --request POST 'http://example.com/api/v1/node/example_content_type/content_uuid/field_file' \
--header 'Accept: application/vnd.api+json' \
--header 'Content-Disposition: file; filename="example_file.txt"' \
--header 'Content-Type: application/octet-stream' \
--header 'Authorization: Basic e3t1c2VybmFtZX19Ont7cGFzc3dvcmR9fQ==' \
--data-binary '@example_file.txt'

Error looks like

Error: Call to a member function get() on null in Drupal\autologout\EventSubscriber\AutologoutSubscriber->onRequest() (line 123 of /app/web/modules/contrib/autologout/src/EventSubscriber/AutologoutSubscriber.php)
#0 [internal function]: Drupal\autologout\EventSubscriber\AutologoutSubscriber->onRequest(Object(Symfony\Component\HttpKernel\Event\RequestEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))

Patch provided.

🐛 Bug report
Status

Postponed

Version

1.0

Component

Code

Created by

🇦🇺Australia au_dave Adelaide

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024