1. Sebastian Sebastian
  2. scm-manager
  3. Issues

Issues

Issue #156 resolved

Repository links should use relative paths

DRayX
created an issue

It would be awesome if the links to the repositories and the clone URI were based on the URL currently being used to access the page, instead of the base address set in the general config. This way, if different users are accessing the site from different domains with different DNS entries, all of the links will work.

Comments (8)

  1. DRayX reporter
    • marked as bug
    • changed version to 1.16

    So the easiest way to do this would probably be to pass the UriInfo into the appendUrl function instead of the configuration, and then write another version of getCompleteUrl that uses uriInfo.getBaseUri() to create the path. This does have the downside that the url field of the repository objects would be changing every time somebody accessed the homepage with a different cname (or used the ip directly), but the RepositoryRootResource added in 1.16 does this already anyway. (On a side note, changing this at all doesn't quite seem safe as it would appear to break the equality comparison.) This also means that the response to the repository endpoint couldn't be cached. Maybe the best alternative is to change the repository objects to hold the relative path, and then dynamically populate the URL in the javascript after requesting the repository list from the rest API. I an going to switch this to a defect as well as basically whenever the site is accessed via some other path (such as through a proxy), the links and checkout commands don't actually work.

  2. Sebastian Sebastian repo owner

    It is not possible to send a relative path in the url field of a repository, because this would break the current behavior and some plugins would work with a non complete url. Send a relative path could be a feature for a 2.0 release, because the break in the api behavior. But at the moment i think the only way to do this, is the changing url you described and yes you are right this would break the equals and the hashcode method. I'm not sure if i can fix this problem now or whether i should wait for the 2.0 release, because the problem occurs only in a very specific configuration of scm-manager. I have to think about it.

  3. DRayX reporter

    Would it be possible to send the relative path in addition to the full url, and then have the javascript that populates the repositories tab (and info pannel) add the base path? Then, in version 2.0 you could potentially remove (or deprecate) the full url? It may be interesting to look at the source for Sonatype Nexus as they were able to solve essentially an identical problem. They use Tomcat and ExtJS and give paths to the repositories determined by the base url used to access the page (actually, SCM-Manager looks a lot like Nexus (which is a good thing IMHO)).

  4. Sebastian Sebastian repo owner

    This sounds good. I will deprecate the full url and introduce a new field for the relative url. After that the urls which are shown in the webinterface should be generated from the relative url. I will add this feature if i finished the new repository api. But the new repository api could take some time, so if you able to fix it yourself just clone the repository and create a pull request.

  5. DRayX reporter

    Looks good. I wasn't able to test it in my actual environment (deployed as a WAR in Tomcat7), but just running it standalone on one of my test machines it seemed to work fine. Thanks.

  6. Log in to comment