From c67a749036811cbd65e7b7d03d6a3e58e0a91bc1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 18 May 2011 10:06:35 -0700 Subject: [PATCH] Verify that SVN repository URI ends in a "/" Summary: Everything breaks if this isn't true, and it's easy to get subtly wrong right now. There are other more magical ways we could do this (automatically add a "/" in this form or at runtime) but I think making it explicit is the easiest and most robust approach. See T67. Test Plan: Tried to save a URI without a trailing slash. Reviewed By: jungejason Reviewers: jungejason, tuomaspelkonen, aran CC: aran, jungejason Differential Revision: 305 --- .../edit/PhabricatorRepositoryEditController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php index 3491dd6234..2794cb2c02 100644 --- a/src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php @@ -258,10 +258,20 @@ class PhabricatorRepositoryEditController if (!$repository->getDetail('remote-uri')) { $e_uri = 'Required'; $errors[] = "Repository URI is required."; + } else if ($is_svn && + !preg_match('@/$@', $repository->getDetail('remote-uri'))) { + + $e_uri = 'Invalid'; + $errors[] = 'Subversion Repository URI must end in a slash ("/").'; + } else { + $e_uri = null; } + if (!$repository->getDetail('local-path')) { $e_path = 'Required'; $errors[] = "Local path is required."; + } else { + $e_path = null; } }