1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Require canonical numbers in routes

Summary:
D03646 works, I don't want it to work.
Theoretically, it can cause us some troubles if we use this string in JS number context where 030 is 24.

Test Plan: D03646, D3646

Reviewers: epriestley, edward

Reviewed By: edward

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3646
This commit is contained in:
vrana 2012-10-05 16:06:16 -07:00
parent 26d62ee450
commit 22cb8f5d08
20 changed files with 62 additions and 57 deletions

View file

@ -37,7 +37,7 @@ final class PhabricatorApplicationAudit extends PhabricatorApplication {
'view/(?P<filter>[^/]+)/(?:(?P<name>[^/]+)/)?'
=> 'PhabricatorAuditListController',
'addcomment/' => 'PhabricatorAuditAddCommentController',
'preview/(?P<id>\d+)/' => 'PhabricatorAuditPreviewController',
'preview/(?P<id>[1-9]\d*)/' => 'PhabricatorAuditPreviewController',
),
);
}

View file

@ -47,11 +47,11 @@ final class PhabricatorApplicationCountdown extends PhabricatorApplication {
'/countdown/' => array(
''
=> 'PhabricatorCountdownListController',
'(?P<id>\d+)/'
'(?P<id>[1-9]\d*)/'
=> 'PhabricatorCountdownViewController',
'edit/(?:(?P<id>\d+)/)?'
'edit/(?:(?P<id>[1-9]\d*)/)?'
=> 'PhabricatorCountdownEditController',
'delete/(?P<id>\d+)/'
'delete/(?P<id>[1-9]\d*)/'
=> 'PhabricatorCountdownDeleteController'
),
);

View file

@ -45,16 +45,17 @@ final class PhabricatorApplicationDaemons extends PhabricatorApplication {
public function getRoutes() {
return array(
'/daemon/' => array(
'task/(?P<id>\d+)/' => 'PhabricatorWorkerTaskDetailController',
'task/(?P<id>\d+)/(?P<action>[^/]+)/'
'task/(?P<id>[1-9]\d*)/' => 'PhabricatorWorkerTaskDetailController',
'task/(?P<id>[1-9]\d*)/(?P<action>[^/]+)/'
=> 'PhabricatorWorkerTaskUpdateController',
'log/' => array(
'(?P<running>running/)?' => 'PhabricatorDaemonLogListController',
'combined/' => 'PhabricatorDaemonCombinedLogController',
'(?P<id>\d+)/' => 'PhabricatorDaemonLogViewController',
'(?P<id>[1-9]\d*)/' => 'PhabricatorDaemonLogViewController',
),
'timeline/' => 'PhabricatorDaemonTimelineConsoleController',
'timeline/(?P<id>\d+)/' => 'PhabricatorDaemonTimelineEventController',
'timeline/(?P<id>[1-9]\d*)/'
=> 'PhabricatorDaemonTimelineEventController',
'' => 'PhabricatorDaemonConsoleController',
),
);

View file

@ -38,29 +38,30 @@ final class PhabricatorApplicationDifferential extends PhabricatorApplication {
public function getRoutes() {
return array(
'/D(?P<id>\d+)' => 'DifferentialRevisionViewController',
'/D(?P<id>[1-9]\d*)' => 'DifferentialRevisionViewController',
'/differential/' => array(
'' => 'DifferentialRevisionListController',
'filter/(?P<filter>\w+)/(?:(?P<username>[\w\.-_]+)/)?' =>
'DifferentialRevisionListController',
'stats/(?P<filter>\w+)/' => 'DifferentialRevisionStatsController',
'diff/' => array(
'(?P<id>\d+)/' => 'DifferentialDiffViewController',
'(?P<id>[1-9]\d*)/' => 'DifferentialDiffViewController',
'create/' => 'DifferentialDiffCreateController',
),
'changeset/' => 'DifferentialChangesetViewController',
'revision/edit/(?:(?P<id>\d+)/)?'
'revision/edit/(?:(?P<id>[1-9]\d*)/)?'
=> 'DifferentialRevisionEditController',
'comment/' => array(
'preview/(?P<id>\d+)/' => 'DifferentialCommentPreviewController',
'preview/(?P<id>[1-9]\d*)/' => 'DifferentialCommentPreviewController',
'save/' => 'DifferentialCommentSaveController',
'inline/' => array(
'preview/(?P<id>\d+)/' =>
'DifferentialInlineCommentPreviewController',
'edit/(?P<id>\d+)/' => 'DifferentialInlineCommentEditController',
'preview/(?P<id>[1-9]\d*)/'
=> 'DifferentialInlineCommentPreviewController',
'edit/(?P<id>[1-9]\d*)/'
=> 'DifferentialInlineCommentEditController',
),
),
'subscribe/(?P<action>add|rem)/(?P<id>\d+)/'
'subscribe/(?P<action>add|rem)/(?P<id>[1-9]\d*)/'
=> 'DifferentialSubscribeController',
),
);

View file

@ -44,13 +44,13 @@ final class PhabricatorApplicationFiles extends PhabricatorApplication {
public function getRoutes() {
return array(
'/F(?P<id>\d+)' => 'PhabricatorFileShortcutController',
'/F(?P<id>[1-9]\d*)' => 'PhabricatorFileShortcutController',
'/file/' => array(
'' => 'PhabricatorFileListController',
'filter/(?P<filter>\w+)/' => 'PhabricatorFileListController',
'upload/' => 'PhabricatorFileUploadController',
'dropupload/' => 'PhabricatorFileDropUploadController',
'delete/(?P<id>\d+)/' => 'PhabricatorFileDeleteController',
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorFileDeleteController',
'info/(?P<phid>[^/]+)/' => 'PhabricatorFileInfoController',
'data/(?P<key>[^/]+)/(?P<phid>[^/]+)/.*'
=> 'PhabricatorFileDataController',

View file

@ -65,7 +65,7 @@ final class PhabricatorApplicationFlags extends PhabricatorApplication {
'' => 'PhabricatorFlagListController',
'view/(?P<view>[^/]+)/' => 'PhabricatorFlagListController',
'edit/(?P<phid>[^/]+)/' => 'PhabricatorFlagEditController',
'delete/(?P<id>\d+)/' => 'PhabricatorFlagDeleteController',
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorFlagDeleteController',
),
);
}

View file

@ -54,12 +54,12 @@ final class PhabricatorApplicationHerald extends PhabricatorApplication {
=> 'HeraldHomeController',
'new/(?:(?P<type>[^/]+)/(?:(?P<rule_type>[^/]+)/)?)?'
=> 'HeraldNewController',
'rule/(?:(?P<id>\d+)/)?' => 'HeraldRuleController',
'history/(?:(?P<id>\d+)/)?' => 'HeraldRuleEditHistoryController',
'delete/(?P<id>\d+)/' => 'HeraldDeleteController',
'rule/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleController',
'history/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleEditHistoryController',
'delete/(?P<id>[1-9]\d*)/' => 'HeraldDeleteController',
'test/' => 'HeraldTestConsoleController',
'transcript/' => 'HeraldTranscriptListController',
'transcript/(?P<id>\d+)/(?:(?P<filter>\w+)/)?'
'transcript/(?P<id>[1-9]\d*)/(?:(?P<filter>\w+)/)?'
=> 'HeraldTranscriptController',
),
);

View file

@ -42,8 +42,8 @@ final class PhabricatorApplicationMacro extends PhabricatorApplication {
return array(
'/macro/' => array(
'' => 'PhabricatorMacroListController',
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorMacroEditController',
'delete/(?P<id>\d+)/' => 'PhabricatorMacroDeleteController',
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'PhabricatorMacroEditController',
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorMacroDeleteController',
),
);
}

View file

@ -42,7 +42,8 @@ final class PhabricatorApplicationMailingLists extends PhabricatorApplication {
return array(
'/mailinglists/' => array(
'' => 'PhabricatorMailingListsListController',
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorMailingListsEditController',
'edit/(?:(?P<id>[1-9]\d*)/)?'
=> 'PhabricatorMailingListsEditController',
),
);
}

View file

@ -50,7 +50,7 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
public function getRoutes() {
return array(
'/T(?P<id>\d+)' => 'ManiphestTaskDetailController',
'/T(?P<id>[1-9]\d*)' => 'ManiphestTaskDetailController',
'/maniphest/' => array(
'' => 'ManiphestTaskListController',
'view/(?P<view>\w+)/' => 'ManiphestTaskListController',
@ -58,22 +58,23 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
'batch/' => 'ManiphestBatchEditController',
'task/' => array(
'create/' => 'ManiphestTaskEditController',
'edit/(?P<id>\d+)/' => 'ManiphestTaskEditController',
'descriptionchange/(?:(?P<id>\d+)/)?' =>
'edit/(?P<id>[1-9]\d*)/' => 'ManiphestTaskEditController',
'descriptionchange/(?:(?P<id>[1-9]\d*)/)?' =>
'ManiphestTaskDescriptionChangeController',
'descriptionpreview/' =>
'ManiphestTaskDescriptionPreviewController',
),
'transaction/' => array(
'save/' => 'ManiphestTransactionSaveController',
'preview/(?P<id>\d+)/' => 'ManiphestTransactionPreviewController',
'preview/(?P<id>[1-9]\d*)/'
=> 'ManiphestTransactionPreviewController',
),
'export/(?P<key>[^/]+)/' => 'ManiphestExportController',
'subpriority/' => 'ManiphestSubpriorityController',
'custom/' => array(
'' => 'ManiphestSavedQueryListController',
'edit/(?:(?P<id>\d+)/)?' => 'ManiphestSavedQueryEditController',
'delete/(?P<id>\d+)/' => 'ManiphestSavedQueryDeleteController',
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'ManiphestSavedQueryEditController',
'delete/(?P<id>[1-9]\d*)/' => 'ManiphestSavedQueryDeleteController',
),
),
);

View file

@ -43,7 +43,7 @@ final class PhabricatorApplicationMetaMTA extends PhabricatorApplication {
$this->getBaseURI() => array(
'' => 'PhabricatorMetaMTAListController',
'send/' => 'PhabricatorMetaMTASendController',
'view/(?P<id>\d+)/' => 'PhabricatorMetaMTAViewController',
'view/(?P<id>[1-9]\d*)/' => 'PhabricatorMetaMTAViewController',
'receive/' => 'PhabricatorMetaMTAReceiveController',
'received/' => 'PhabricatorMetaMTAReceivedListController',
'sendgrid/' => 'PhabricatorMetaMTASendGridReceiveController',

View file

@ -51,10 +51,10 @@ final class PhabricatorApplicationOwners extends PhabricatorApplication {
'/owners/' => array(
'' => 'PhabricatorOwnersListController',
'view/(?P<view>[^/]+)/' => 'PhabricatorOwnersListController',
'edit/(?P<id>\d+)/' => 'PhabricatorOwnersEditController',
'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorOwnersEditController',
'new/' => 'PhabricatorOwnersEditController',
'package/(?P<id>\d+)/' => 'PhabricatorOwnersDetailController',
'delete/(?P<id>\d+)/' => 'PhabricatorOwnersDeleteController',
'package/(?P<id>[1-9]\d*)/' => 'PhabricatorOwnersDetailController',
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorOwnersDeleteController',
),
);
}

View file

@ -36,10 +36,10 @@ final class PhabricatorApplicationPaste extends PhabricatorApplication {
public function getRoutes() {
return array(
'/P(?P<id>\d+)' => 'PhabricatorPasteViewController',
'/P(?P<id>[1-9]\d*)' => 'PhabricatorPasteViewController',
'/paste/' => array(
'' => 'PhabricatorPasteEditController',
'edit/(?P<id>\d+)/' => 'PhabricatorPasteEditController',
'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorPasteEditController',
'filter/(?P<filter>\w+)/' => 'PhabricatorPasteListController',
),
);

View file

@ -47,7 +47,7 @@ final class PhabricatorApplicationPeople extends PhabricatorApplication {
'/people/' => array(
'' => 'PhabricatorPeopleListController',
'logs/' => 'PhabricatorPeopleLogsController',
'edit/(?:(?P<id>\d+)/(?:(?P<view>\w+)/)?)?'
'edit/(?:(?P<id>[1-9]\d*)/(?:(?P<view>\w+)/)?)?'
=> 'PhabricatorPeopleEditController',
'ldap/' => 'PhabricatorPeopleLdapController',
),

View file

@ -48,11 +48,11 @@ final class PhabricatorApplicationPhriction extends PhabricatorApplication {
'history(?P<slug>/)' => 'PhrictionHistoryController',
'history/(?P<slug>.+/)' => 'PhrictionHistoryController',
'edit/(?:(?P<id>\d+)/)?' => 'PhrictionEditController',
'delete/(?P<id>\d+)/' => 'PhrictionDeleteController',
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'PhrictionEditController',
'delete/(?P<id>[1-9]\d*)/' => 'PhrictionDeleteController',
'preview/' => 'PhrictionDocumentPreviewController',
'diff/(?P<id>\d+)/' => 'PhrictionDiffController',
'diff/(?P<id>[1-9]\d*)/' => 'PhrictionDiffController',
),
);
}

View file

@ -49,7 +49,7 @@ final class PhabricatorApplicationPonder extends PhabricatorApplication {
public function getroutes() {
return array(
'/Q(?P<id>\d+)' => 'PonderQuestionViewController',
'/Q(?P<id>[1-9]\d*)' => 'PonderQuestionViewController',
'/ponder/' => array(
'(?P<page>feed/)?' => 'PonderFeedController',
'(?P<page>questions)/' => 'PonderFeedController',

View file

@ -47,12 +47,13 @@ final class PhabricatorApplicationProject extends PhabricatorApplication {
'/project/' => array(
'' => 'PhabricatorProjectListController',
'filter/(?P<filter>[^/]+)/' => 'PhabricatorProjectListController',
'edit/(?P<id>\d+)/' => 'PhabricatorProjectProfileEditController',
'members/(?P<id>\d+)/' => 'PhabricatorProjectMembersEditController',
'view/(?P<id>\d+)/(?:(?P<page>\w+)/)?'
'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectProfileEditController',
'members/(?P<id>[1-9]\d*)/'
=> 'PhabricatorProjectMembersEditController',
'view/(?P<id>[1-9]\d*)/(?:(?P<page>\w+)/)?'
=> 'PhabricatorProjectProfileController',
'create/' => 'PhabricatorProjectCreateController',
'update/(?P<id>\d+)/(?P<action>[^/]+)/'
'update/(?P<id>[1-9]\d*)/(?P<action>[^/]+)/'
=> 'PhabricatorProjectUpdateController',
),
);

View file

@ -43,12 +43,12 @@ final class PhabricatorApplicationRepositories extends PhabricatorApplication {
'/repository/' => array(
'' => 'PhabricatorRepositoryListController',
'create/' => 'PhabricatorRepositoryCreateController',
'edit/(?P<id>\d+)/(?:(?P<view>\w+)/)?' =>
'edit/(?P<id>[1-9]\d*)/(?:(?P<view>\w+)/)?' =>
'PhabricatorRepositoryEditController',
'delete/(?P<id>\d+)/' => 'PhabricatorRepositoryDeleteController',
'project/edit/(?P<id>\d+)/' =>
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorRepositoryDeleteController',
'project/edit/(?P<id>[1-9]\d*)/' =>
'PhabricatorRepositoryArcanistProjectEditController',
'project/delete/(?P<id>\d+)/' =>
'project/delete/(?P<id>[1-9]\d*)/' =>
'PhabricatorRepositoryArcanistProjectDeleteController',
),
);

View file

@ -48,7 +48,7 @@ final class PhabricatorApplicationSlowvote extends PhabricatorApplication {
public function getRoutes() {
return array(
'/V(?P<id>\d+)' => 'PhabricatorSlowvotePollController',
'/V(?P<id>[1-9]\d*)' => 'PhabricatorSlowvotePollController',
'/vote/' => array(
'(?:view/(?P<view>\w+)/)?' => 'PhabricatorSlowvoteListController',
'create/' => 'PhabricatorSlowvoteCreateController',

View file

@ -42,15 +42,15 @@ final class PhabricatorApplicationPHPAST extends PhabricatorApplication {
return array(
'/xhpast/' => array(
'' => 'PhabricatorXHPASTViewRunController',
'view/(?P<id>\d+)/'
'view/(?P<id>[1-9]\d*)/'
=> 'PhabricatorXHPASTViewFrameController',
'frameset/(?P<id>\d+)/'
'frameset/(?P<id>[1-9]\d*)/'
=> 'PhabricatorXHPASTViewFramesetController',
'input/(?P<id>\d+)/'
'input/(?P<id>[1-9]\d*)/'
=> 'PhabricatorXHPASTViewInputController',
'tree/(?P<id>\d+)/'
'tree/(?P<id>[1-9]\d*)/'
=> 'PhabricatorXHPASTViewTreeController',
'stream/(?P<id>\d+)/'
'stream/(?P<id>[1-9]\d*)/'
=> 'PhabricatorXHPASTViewStreamController',
),
);