jeremyevans/roda

String matcher in hash_routes combined with unescape_path does not match non-ascii strings

Closed this issue · 1 comments

Consider the following example:

# frozen_string_literal: true

require 'roda'

class Foobar < Roda
  plugin :hash_routes
  #plugin :unescape_path

  route do |r|
    r.hash_routes
  end

  hash_routes.on 'foobar' do |r|
    r.on String do |p|
      "hi #{p}"
    end
  end
end

run Foobar.freeze.app

Requesting /foobar/ä works as expected.

But after enabling plugin :unescape_path the same request returns a 404.

Thanks for the report. I can reproduce the issue. You can currently work around this by providing an explicit namespace when calling hash_routes: r.hash_routes(''). I'll try to determine why matched_path is set to the full path when using the unescape_path plugin.