Problem/Motivation
It worth noted that if we use JSON:API Extras to rename file--file into something else (files for example). The \Drupal\jsonapi\Controller\FileUpload will not work anymore, because this resource Route name is hard-coded in \Drupal\jsonapi\Controller\FileUpload::handleFileUploadForNewResource :
...
// @todo Remove line below in favor of commented line in https://www.drupal.org/project/drupal/issues/2878463.
$self_link = new Link(new CacheableMetadata(), Url::fromRoute('jsonapi.file--file.individual', ['entity' => $file->uuid()]), 'self');
/* $self_link = new Link(new CacheableMetadata(), $this->entity->toUrl('jsonapi'), ['self']); */
$links = new LinkCollection(['self' => $self_link]);
...
Steps to reproduce
Rename the resource, and use the JSON:API endpoint to upload a file.
Example : /jsonapi/node/article/{file_field_name}
Proposed resolution
Lock this particular resource name until the @todo in the line above is done.
Remaining tasks
TBD
User interface changes
The "Resource Type" field in the "Edit file--file resource config" Form may be read-only.
Comments
Comment #2
mattew commentedComment #3
mattew commentedI'm not quite sure but this may be a duplicate of https://www.drupal.org/project/jsonapi_extras/issues/3063085
Which is open since more than 4 years... and the related Core bug also!
Maybe we could think about implementing a special case for this Resource, and lock the Resource Type field, as I suggested?