Mojolicious API 忽略了 URL 参数中“.”之后的字符

Mojolicious API is disregarding the characters after " . " in the URL argument

我在我的代码中定义了以下路由:

my $route = $r->any('/api')->to('API#');
$route->get('/get_data/:filename')->to('#submit_forms');

如果我传递给 url 的文件名是“foo123456.bar_baz.bz2”,当我打印参数时,我得到:(例如 http://example.com/api/get_data/foo123456.bar_baz.bz2

print Dumper($c->param('filename'));
# foo123456

为什么经期后一切都被砍掉了?

使用 #(或 *)代替 : 作为占位符:

$route->get('/get_data/#filename')->to('#submit_forms');

Mojolicious 有 3 种占位符:

引用宽松占位符的文档:

They can be especially useful for manually matching file names with extensions