diff --git a/app/Http/Controllers/NotesController.php b/app/Http/Controllers/NotesController.php index 2a5dcb3f..ef215f58 100644 --- a/app/Http/Controllers/NotesController.php +++ b/app/Http/Controllers/NotesController.php @@ -155,6 +155,15 @@ class NotesController extends Controller */ public function taggedNotes($tag) { + $tag = mb_strtolower( + preg_replace( + '/&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);/i', + '$1', + htmlentities($tag) + ), + 'UTF-8' + ); + $tagId = Tag::where('tag', $tag)->pluck('id'); $notes = Tag::find($tagId)->notes()->orderBy('updated_at', 'desc')->get(); foreach ($notes as $note) { diff --git a/tests/MicropubClientTest.php b/tests/MicropubClientTest.php index f94006db..d0c47e4d 100644 --- a/tests/MicropubClientTest.php +++ b/tests/MicropubClientTest.php @@ -43,10 +43,10 @@ class MicropubClientTest extends TestCase /** * This currently creates a new note that stays in the database. */ - public function testClientCreatesNewNote() + public function testClientCreatesNewNoteWithTag() { $faker = \Faker\Factory::create(); - $note = 'Fake note from PHPUnit: ' . $faker->text; + $note = 'Fake note from #PHPUnit: ' . $faker->text; $this->withSession([ 'me' => $this->appurl, 'token' => $this->getToken() @@ -54,6 +54,8 @@ class MicropubClientTest extends TestCase ->type($note, 'content') ->press('Submit'); $this->seeInDatabase('notes', ['note' => $note]); + $this->visit($this->appurl . '/notes/tagged/PHPUnit') + ->see('PHPUnit'); }