SonarQube 6.7.4 LTS: "Sources" link in Project is constructed incorrectly

ui

(Alix Warnke) #1
  • SonarQube 6.7.4 LTS

Steps to reproduce

  • Log in to SonarQube
  • Go to a project
  • View the right hand side. There is a link “Sources”
  • Press the link

Expected
URL correctly redirects to the source code repository

Actual
URL is prefixed with the SonarQube server host URL.

Example:
If SonarQube is hosted at https://sonar.com and the repository is hosted at https://github.com/project then the resulting URL becomes: https://sonar.com/github.com/project


(Tibor Blenessy) #2

Hello Alix,

I was not able to reproduce this behavior. Which scanner do you use? This information is set via properties by scanner, I think you should check the way how this link is provided (if it starts with the protocol for example) .


(Alix Warnke) #3

Hi, I’m using the Gradle SonarQube plugin. Which property should I look for?


(Janos Gyerik) #5

How did you configure the URL to your sources? It seems that it is defined as github.com/project instead of https://github.com/project. SonarQube uses the provided URL as given. If it’s a relative URL like github.com/project then it will appear relative to the SonarQube server. (This is just standard HTML behavior.)

If you don’t know where you specified the URL, I suggest to search in your sources, for example git grep -w github.com/project to find the location, and change it to be a complete URL with https:// prefix.


(Alix Warnke) #6

Hi,
I need to know which property you are looking for. Otherwise I cannot tell you how I formatted my URL

/ Alix


(Janos Gyerik) #7

It could come for example from sonar.links.scm. It can also be detected from other properties defined within build.gradle or other configuration files of Gradle. It’s not easy to pinpoint all the possible places. I will update this thread when I have more accurate information but that will take time. You may find the location faster yourself by searching in your code as I suggested in my previous comment.


(Alix Warnke) #8

Thank you for the explanation.
I’m sorry to say, but I can no longer reproduce this issue. I don’t remember which project was affected but I remember clearly that of all relevant properties I could find there was an absolute URL prefixed with http:// so it wasn’t clear to me why this became an issue in SQ.

/ Alix


(Janos Gyerik) #9

Thanks for the update.

I can only confirm that we never construct this URL from parts. That is, we never take some part of it from somewhere, and then decide to add https:// or not. We look for a value specified by sonar.links.scm or other, and use it as is. So the solution is always going to be in the project’s configuration.