changeset 87:21418e115be0 9.0.x

fixed TW-40753 + test added
author Evgeniy.Koshkin
date Thu, 16 Apr 2015 14:01:45 +0300
parents fc50962148fa
children cd94a00060bd
files server-tests/src/jetbrains/buildServer/symbols/DownloadSymbolsControllerTest.java server/src/jetbrains/buildServer/symbols/BuildSymbolsIndexProvider.java server/src/jetbrains/buildServer/symbols/DownloadSymbolsController.java
diffstat 3 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/server-tests/src/jetbrains/buildServer/symbols/DownloadSymbolsControllerTest.java	Thu Apr 16 14:01:04 2015 +0300
+++ b/server-tests/src/jetbrains/buildServer/symbols/DownloadSymbolsControllerTest.java	Thu Apr 16 14:01:45 2015 +0300
@@ -99,6 +99,27 @@
     assertEquals(HttpStatus.SC_UNAUTHORIZED, myResponse.getStatus());
   }
 
+  @Test
+  public void request_pdb_guid_toLowerCase() throws Exception{
+    myFixture.getServerSettings().setPerProjectPermissionsEnabled(true);
+    SUser user = myFixture.getUserModel().getGuestUser();
+    user.addRole(RoleScope.projectScope(myProject.getProjectId()), getProjectDevRole());
+    assertTrue(user.isPermissionGrantedForProject(myProject.getProjectId(), Permission.VIEW_BUILD_RUNTIME_DATA));
+
+    final File artDirectory = createTempDir();
+    new File(artDirectory, "foo").createNewFile();
+    myBuildType.setArtifactPaths(artDirectory.getAbsolutePath());
+    RunningBuildEx build = startBuild();
+
+    final String fileSignature = "8EF4E863187C45E78F4632152CC82FEB";
+    final String fileName = "secur32.pdb";
+    myBuildMetadataStorage.addEntry(build.getBuildId(), fileName, fileSignature);
+
+    myRequest.setRequestURI("mock", String.format("/app/symbols/%s/%s/%s", fileName, fileSignature.toLowerCase(), fileName));
+    doGet();
+    assertEquals(HttpStatus.SC_OK, myResponse.getStatus());
+  }
+
   private String getRegisterPdbUrl(String fileName, String fileSignature) throws IOException {
     final File artDirectory = createTempDir();
     new File(artDirectory, "foo").createNewFile();
--- a/server/src/jetbrains/buildServer/symbols/BuildSymbolsIndexProvider.java	Thu Apr 16 14:01:04 2015 +0300
+++ b/server/src/jetbrains/buildServer/symbols/BuildSymbolsIndexProvider.java	Thu Apr 16 14:01:45 2015 +0300
@@ -83,7 +83,7 @@
   }
 
   private String extractGuid(String sign) {
-    return sign.substring(0, sign.length() - 1); //last symbol is PEDebugType
+    return sign.substring(0, sign.length() - 1).toLowerCase(); //last symbol is PEDebugType
   }
 
   private String locateArtifact(SBuild build, final String fileName) {
--- a/server/src/jetbrains/buildServer/symbols/DownloadSymbolsController.java	Thu Apr 16 14:01:04 2015 +0300
+++ b/server/src/jetbrains/buildServer/symbols/DownloadSymbolsController.java	Thu Apr 16 14:01:45 2015 +0300
@@ -85,7 +85,7 @@
 
     final String fileName = valuableUriPart.substring(0, firstDelimiterPosition);
     final String signature = valuableUriPart.substring(firstDelimiterPosition + 1, valuableUriPart.indexOf('/', firstDelimiterPosition + 1));
-    final String guid = signature.substring(0, signature.length() - 1); //last symbol is PEDebugType
+    final String guid = signature.substring(0, signature.length() - 1).toLowerCase(); //last symbol is PEDebugType
     LOG.debug(String.format("Symbol file requested. File name: %s. Guid: %s.", fileName, guid));
 
     final String projectId = findRelatedProjectId(guid);