Support .-Symbol in IDs
Change-Id: I16d27493064ae1449360a382a1e49b21c542b09c
diff --git a/Changes b/Changes
index b88b243..95957be 100755
--- a/Changes
+++ b/Changes
@@ -1,10 +1,12 @@
-0.51 2023-09-18
+0.51 2023-09-26
- Support defined log file in configuration. (diewald)
- Remove experimental_client_registration setting
and make client registration mandatory in OAuth
(diewald)
- Introduce 'reserved terms' in documentation (diewald)
- Support CQP in frontend (diewald)
+ - Fix support for dot-symbols in (corpus/doc/text)-IDs
+ (diewald)
0.50 2023-05-08
- Improvement of NKJP-annotation helper. (diewald)
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 5de4c22..b4fa1ba 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -387,9 +387,9 @@
# Match route
# Corpus route
my $corpus = $r->get('/corpus')->to('search#corpus_info')->name('corpus');
- my $doc = $r->any('/corpus/:corpus_id/:doc_id');
- my $text = $doc->get('/:text_id')->to('search#text_info')->name('text');
- my $match = $doc->get('/:text_id/:match_id')->to('search#match_info')->name('match');
+ my $doc = $r->any('/corpus/#corpus_id/#doc_id');
+ my $text = $doc->get('/#text_id')->to('search#text_info')->name('text');
+ my $match = $doc->get('/#text_id/#match_id')->to('search#match_info')->name('match');
};
diff --git a/t/server/mock.pl b/t/server/mock.pl
index e27542a..3b0959f 100644
--- a/t/server/mock.pl
+++ b/t/server/mock.pl
@@ -227,7 +227,7 @@
};
# Textinfo fixtures
-get '/v1.0/corpus/:corpusId/:docId/:textId' => sub {
+get '/v1.0/corpus/#corpusId/#docId/#textId' => sub {
my $c = shift;
my $file = join('_', (
@@ -246,7 +246,7 @@
# Matchinfo fixtures
-get '/v1.0/corpus/:corpusId/:docId/:textId/:matchId/matchInfo' => sub {
+get '/v1.0/corpus/#corpusId/#docId/#textId/#matchId/matchInfo' => sub {
my $c = shift;
my $file = join('_', (
diff --git a/t/text_info.t b/t/text_info.t
index 82e6a97..55b9637 100644
--- a/t/text_info.t
+++ b/t/text_info.t
@@ -37,6 +37,13 @@
->json_is('/notifications/0/1', '630: Document not found')
;
+# Real example from NKJP
+$t->get_ok('/corpus/NKJP/NKJP/forumowisko.pl_57')
+ ->status_is(200)
+ ->json_like('/notifications/0/1', qr!^Unable to load!)
+ ;
+
+
done_testing;
__END__