Faced the same issue.
I agree killing the response is a big deal, but the problem here is that although having files with spaces is allowed, links, according to the JSONAPI specs (https://jsonapi.org/format/#document-links) , MUST follow RFC3986, which does not allow spaces.
FYI attached patch is not an ideal one, it should be applied at the derivative link generation step, but I was unable to break at the derivative link generation step (and flushing caches did not help), so I just parse it, sanitize and build it back.
Probably replacing back %2F is not a good idea either. A room for an improvement.
Attached patch was tested on spaces and all the rest stuff. :, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, =
Attached is the patch against 10.3.2.
The changes include configurable Field Widget settings. Both view and display ID can be chosen.
I took the recent MediaLibraryState changes from the merge request by john.karahalis and added configurable field widget settings form based on the #6 by chr.fritsch, as well as the proper MediaLibraryState creation.
NOTE 1: If you use the patch as is, for the sake of simplicity of the patch, your new views should start with 'media_library' prefix. If you would like to change that, see the diff at line 10 or implement your own hook/change the patch. This view id check and the next classes adjustments are needed for the JS behaviors to properly process the view.
.
NOTE 2: This patch does not affect theming. You will still have to make copies of views-view--[yourviewid].html.twig and views-view-unformatted--[yourviewid].html.twig (just make copies of the defaults and rename).
NOTE 3: There are no tests.
Tested at 10.3.2.
conspirolog → changed the visibility of the branch 2971209-media-library-custom-view-id to active.
conspirolog → changed the visibility of the branch 2971209-media-library-custom-view-id to hidden.