Append current query string to private file urls? If I use template_preprocess_file_link, can I add the current url query string and append it to the link per user? Will this link be cached for all users?

Update:

This appends it, but does seem to get cached:

  if (preg_match('/private:\/\//i', $file_entity-&gt;getFileUri())) {
    $query = \Drupal::requestStack()-&gt;getCurrentRequest()-&gt;query-&gt;all();

    if (!empty($query)) {
      $options['query'] = $query;
    }
  }

  $variables['link'] = \Drupal::l($link_text, Url::fromUri($url, $options));
Adding this cache context seemed to do it (although I do not know if this is bulletproof):

  if (preg_match('/private:\/\//i', $file_entity-&gt;getFileUri())) {
    $query = \Drupal::requestStack()-&gt;getCurrentRequest()-&gt;query-&gt;all();

    if (!empty($query)) {
      $options['query'] = $query;
    }

    $variables['#cache']['contexts'][] = 'url.query_args';
  }