Update GetControlFileList to return the relative
path of the control files, update GetControlFile
to support paths with leading slashes.

BUG=None
TEST=Ran local tests with devserver + curl to exercise both
pathways.

Change-Id: If86d9b0f89b984c7e3ad9c6490528922c8eceff0
Reviewed-on: https://gerrit.chromium.org/gerrit/14234
Tested-by: Scott Zawalski <scottz@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Commit-Ready: Scott Zawalski <scottz@chromium.org>
diff --git a/devserver_util.py b/devserver_util.py
index 4c41571..e36ad63 100644
--- a/devserver_util.py
+++ b/devserver_util.py
@@ -402,6 +402,8 @@
   Returns:
     Content of the requested control file.
   """
+  # Be forgiving if the user passes in the control_path with a leading /
+  control_path = control_path.lstrip('/')
   control_path = os.path.join(static_dir, build, 'autotest',
                               control_path)
   if not SafeSandboxAccess(static_dir, control_path):
@@ -429,7 +431,7 @@
   Returns:
     String of each file separated by a newline.
   """
-  autotest_dir = os.path.join(static_dir, build, 'autotest')
+  autotest_dir = os.path.join(static_dir, build, 'autotest/')
   if not SafeSandboxAccess(static_dir, autotest_dir):
     raise DevServerUtilError('Autotest dir not in sandbox "%s".' % autotest_dir)
 
@@ -444,7 +446,7 @@
     for file_entry in files:
       if file_entry.startswith('control.') or file_entry == 'control':
         control_files.add(os.path.join(dir_path,
-                                       file_entry).replace(static_dir,''))
+                                       file_entry).replace(autotest_dir,''))
 
   return '\n'.join(control_files)