1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 04:31:13 +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>[^/]+)/)?' 'view/(?P<filter>[^/]+)/(?:(?P<name>[^/]+)/)?'
=> 'PhabricatorAuditListController', => 'PhabricatorAuditListController',
'addcomment/' => 'PhabricatorAuditAddCommentController', '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( '/countdown/' => array(
'' ''
=> 'PhabricatorCountdownListController', => 'PhabricatorCountdownListController',
'(?P<id>\d+)/' '(?P<id>[1-9]\d*)/'
=> 'PhabricatorCountdownViewController', => 'PhabricatorCountdownViewController',
'edit/(?:(?P<id>\d+)/)?' 'edit/(?:(?P<id>[1-9]\d*)/)?'
=> 'PhabricatorCountdownEditController', => 'PhabricatorCountdownEditController',
'delete/(?P<id>\d+)/' 'delete/(?P<id>[1-9]\d*)/'
=> 'PhabricatorCountdownDeleteController' => 'PhabricatorCountdownDeleteController'
), ),
); );

View file

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

View file

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

View file

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

View file

@ -65,7 +65,7 @@ final class PhabricatorApplicationFlags extends PhabricatorApplication {
'' => 'PhabricatorFlagListController', '' => 'PhabricatorFlagListController',
'view/(?P<view>[^/]+)/' => 'PhabricatorFlagListController', 'view/(?P<view>[^/]+)/' => 'PhabricatorFlagListController',
'edit/(?P<phid>[^/]+)/' => 'PhabricatorFlagEditController', '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', => 'HeraldHomeController',
'new/(?:(?P<type>[^/]+)/(?:(?P<rule_type>[^/]+)/)?)?' 'new/(?:(?P<type>[^/]+)/(?:(?P<rule_type>[^/]+)/)?)?'
=> 'HeraldNewController', => 'HeraldNewController',
'rule/(?:(?P<id>\d+)/)?' => 'HeraldRuleController', 'rule/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleController',
'history/(?:(?P<id>\d+)/)?' => 'HeraldRuleEditHistoryController', 'history/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleEditHistoryController',
'delete/(?P<id>\d+)/' => 'HeraldDeleteController', 'delete/(?P<id>[1-9]\d*)/' => 'HeraldDeleteController',
'test/' => 'HeraldTestConsoleController', 'test/' => 'HeraldTestConsoleController',
'transcript/' => 'HeraldTranscriptListController', 'transcript/' => 'HeraldTranscriptListController',
'transcript/(?P<id>\d+)/(?:(?P<filter>\w+)/)?' 'transcript/(?P<id>[1-9]\d*)/(?:(?P<filter>\w+)/)?'
=> 'HeraldTranscriptController', => 'HeraldTranscriptController',
), ),
); );

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -48,11 +48,11 @@ final class PhabricatorApplicationPhriction extends PhabricatorApplication {
'history(?P<slug>/)' => 'PhrictionHistoryController', 'history(?P<slug>/)' => 'PhrictionHistoryController',
'history/(?P<slug>.+/)' => 'PhrictionHistoryController', 'history/(?P<slug>.+/)' => 'PhrictionHistoryController',
'edit/(?:(?P<id>\d+)/)?' => 'PhrictionEditController', 'edit/(?:(?P<id>[1-9]\d*)/)?' => 'PhrictionEditController',
'delete/(?P<id>\d+)/' => 'PhrictionDeleteController', 'delete/(?P<id>[1-9]\d*)/' => 'PhrictionDeleteController',
'preview/' => 'PhrictionDocumentPreviewController', '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() { public function getroutes() {
return array( return array(
'/Q(?P<id>\d+)' => 'PonderQuestionViewController', '/Q(?P<id>[1-9]\d*)' => 'PonderQuestionViewController',
'/ponder/' => array( '/ponder/' => array(
'(?P<page>feed/)?' => 'PonderFeedController', '(?P<page>feed/)?' => 'PonderFeedController',
'(?P<page>questions)/' => 'PonderFeedController', '(?P<page>questions)/' => 'PonderFeedController',

View file

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

View file

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

View file

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

View file

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