title: Suppress file extension detection / format mapping in Rails route
body: <p>I have a Rails route of the form</p>
  
  <pre class="lang-rb prettyprint-override"><code>get '/:collection/*files' =&gt; 'player#index'
  </code></pre>
  
  <p>where <code>files</code> is intended to be a semicolon-separated list of media files, e.g. <code>/my-collection/some-video.mp4%3Bsome-audio.mp3</code></p>
  
  <p>These are handled by a controller action of the form:</p>
  
  <pre><code>class PlayerController &lt; ApplicationController
    def index
      @collection = params[:collection]
      @files = params[:files].split(';')
    end
  end
  </code></pre>
  
  <p>and rendered with a template that displays an HTML5 <code>&lt;audio&gt;</code> or <code>&lt;video&gt;</code> element for each file.</p>
  
  <p>This works fine so long as the files have no extension, e.g.
  <code>/my-collection/file1%3Bfile2</code>.</p>
  
  <p>However, if I add the file extensions,
  <code>/my-collection/foo.mp3%3Bbar.mp4</code>,
  I get:</p>
  
  <blockquote>
    <p><strong>No route matches [GET] "/my-collection/foo.mp3%3Bbar.mp4"</strong></p>
  </blockquote>
  
  <p>And if I try it with a single file, e.g. <code>/my-collection/foo.mp3</code>, I get:</p>
  
  <blockquote>
    <p><strong>PlayerController#index is missing a template for this request format and variant. request.formats: ["audio/mpeg"] request.variant: []</strong></p>
  </blockquote>
  
  <p>Based on <a href="https://stackoverflow.com/a/5369702/27358">this answer</a> I added a regex constraint to the route:</p>
  
  <pre class="lang-rb prettyprint-override"><code>  get '/:collection/*files' =&gt; 'player#index', constraints: {files: /[^\/]+/}
  </code></pre>
  
  <p>This solves the <strong>No route matches</strong> problem, but now the multiple, separated version also fails with <strong>missing a template</strong>. (It's not ideal anyway, since I'd still rather allow <code>/</code> in file values. But <code>/.*/</code> didn't work any better.)</p>
  
  <p>I tried <code>format: false</code>, with and without <code>constraints</code>, and still got <strong>missing a template</strong>.</p>
  
  <p>I also tried an ordinary path parameter (<code>/:collection/:files</code>), and got the same behavior as for the wildcard <code>*files</code>.</p>
  
  <p>How can I get Rails to ignore and pass through the extension for this route?</p>
  
  <hr>
  
  <p><strong>Note:</strong> I'm using Rails 6.0.0 on Ruby 2.5.1.</p>