Skip to content

Commit eb93960

Browse files
committed
improved search: added redirect to package page when full name given
1 parent ea55b5c commit eb93960

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: src/controllers/PackageController.php

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public function actionUpdate()
6868

6969
public function actionSearch($query, $platform = null)
7070
{
71+
if (preg_match('/^(npm|bower)-asset\/[a-zA-Z0-9.-]+$/', $query)) {
72+
return $this->redirect("/package/$query");
73+
}
74+
7175
$activeQuery = \hiqdev\hiart\librariesio\models\Project::find()->where([
7276
'q' => $query,
7377
'platforms' => in_array($platform, ['npm', 'bower'], true) ? $platform : 'bower,npm',

0 commit comments

Comments
 (0)