mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 14:30:56 +01:00
Normalize project slugs before querying for them
Summary: Fixes T5728. In particular: - `/tag/XYZ/` now works as an alias for `/tag/xyz/`. - `arc todo --project ASDF` now works as an alias for `arc todo --project asdf`. Test Plan: Called `project.query` and visited `/tag/LBHABLHBH/`. Reviewers: btrahan Reviewed By: btrahan Subscribers: aklapper, epriestley Maniphest Tasks: T5728 Differential Revision: https://secure.phabricator.com/D10144
This commit is contained in:
parent
42cf7f6faa
commit
1e375c97c5
2 changed files with 8 additions and 2 deletions
|
@ -97,8 +97,9 @@ final class ProjectQueryConduitAPIMethod extends ProjectConduitAPIMethod {
|
||||||
// TODO: This is pretty hideous.
|
// TODO: This is pretty hideous.
|
||||||
$slug_map = array();
|
$slug_map = array();
|
||||||
foreach ($slugs as $slug) {
|
foreach ($slugs as $slug) {
|
||||||
|
$normal = rtrim(PhabricatorSlug::normalize($slug), '/');
|
||||||
foreach ($projects as $project) {
|
foreach ($projects as $project) {
|
||||||
if (in_array($slug, $project['slugs'])) {
|
if (in_array($normal, $project['slugs'])) {
|
||||||
$slug_map[$slug] = $project['phid'];
|
$slug_map[$slug] = $project['phid'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,10 +266,15 @@ final class PhabricatorProjectQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->slugs) {
|
if ($this->slugs) {
|
||||||
|
$slugs = array();
|
||||||
|
foreach ($this->slugs as $slug) {
|
||||||
|
$slugs[] = rtrim(PhabricatorSlug::normalize($slug), '/');
|
||||||
|
}
|
||||||
|
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'slug.slug IN (%Ls)',
|
'slug.slug IN (%Ls)',
|
||||||
$this->slugs);
|
$slugs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->phrictionSlugs) {
|
if ($this->phrictionSlugs) {
|
||||||
|
|
Loading…
Reference in a new issue