Problem/Motivation
If a file url has query parameters, or a hash, added to it. The file-link component strips these out.
Drupal would not normally use query parameters on a file url. But in our case they are being added in by a stream wrapper, from the flysystem_s3 module (we are using them to pass through a url signature, to allow the user access to the file).
Query parameters could also be added in by hook_file_url_alter(), these would again be stripped out.
The issue is caused by the new file handling in template_preprocess_file_link(), which used to create the Url object itself, but now uses the new file_url_generator service. Since this changed was introduced, the $options
is being overwritten by $url->setOptions($options)
Steps to reproduce
Proposed resolution
Use$url->mergeOptions($options)
Instead of$url->setOptions($options)