Make devserver.py send case sensitive urls
The code originally always made all of the urls to lowercase no
matter if the path was representative of the where files were
located on the system. Since case is important in the path of a
URL, the code forcing lowercase needed to be modified so the
path could correctly represent where the files are located on
the file system.
BUG=b:36257342
FIXES=b:36257342
TEST=\
Before change
curl "http://localhost:8080/locate_file?build_id=3814288&
target=bullhead-userdebug&artifacts=test_zip&file_name=pmc.apk&
branch=git_oc-release&async=False&os_type=android&
build_target=bullhead"
DATA/priv-app/PMC/pmk.apk <— incorrect location. pmc.apk does
not exist
curl "http://localhost:8080/locate_file?build_id=3814288&
target=bullhead-userdebug&artifacts=test_zip&file_name=PMC.apk&
branch=git_oc-release&async=False&os_type=android&
build_target=bullhead"
DATA/priv-app/PMC/pmk.apk <— incorrect. Case is not right
After change
curl "http://localhost:8080/locate_file?build_id=3814288&
target=bullhead-userdebug&artifacts=test_zip&file_name=pmc.apk=&
branch=git_oc-release&async=False&os_type=android&
build_target=bullhead"
not found <— correct pmk.apk does not exist
curl "http://localhost:8080/locate_file?build_id=3814288&
target=bullhead-userdebug&artifacts=test_zip&file_name=PMC.apk&
branch=git_oc-release&async=False&os_type=android&
build_target=bullhead"
DATA/priv-app/PMC/PMC.apk <— correct location
Change-Id: I0ec0f93180af45a69856963847efe18ad2842d72
Reviewed-on: https://chromium-review.googlesource.com/455255
Reviewed-by: Joe Brennan <jmbrenna@google.com>
Reviewed-by: Benjamin Peake <bpeake@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
Commit-Queue: Benjamin Peake <bpeake@chromium.org>
Commit-Queue: Joe Brennan <jmbrenna@google.com>
Tested-by: Joe Brennan <jmbrenna@google.com>
diff --git a/devserver.py b/devserver.py
index 5f8b055..fc464ca 100755
--- a/devserver.py
+++ b/devserver.py
@@ -1105,7 +1105,7 @@
"""
dl, _ = _get_downloader_and_factory(kwargs)
try:
- file_name = kwargs['file_name'].lower()
+ file_name = kwargs['file_name']
artifacts = kwargs['artifacts']
except KeyError:
raise DevServerError('`file_name` and `artifacts` are required to search '
@@ -1118,7 +1118,7 @@
folder = artifact_info.ARTIFACT_UNZIP_FOLDER_MAP.get(artifact, '')
artifact_path = os.path.join(build_path, folder)
for root, _, filenames in os.walk(artifact_path):
- if file_name in set([f.lower() for f in filenames]):
+ if file_name in set([f for f in filenames]):
return os.path.relpath(os.path.join(root, file_name), build_path)
raise DevServerError('File `%s` can not be found in artifacts: %s' %
(file_name, artifacts))