Skip to content

valid uri's are flagged as errors in git resource #194

Closed

Description

@shua

The lang server uses github-specific parsing for the uri on the git resource, but that uri can be any valid uri that points to a git instance. Usually not a problem, but if your github url is at eg github.computer.com, that uri gets flagged as

Expecting a ':'

or

Expecting a '/'

image
image

on the p.

It's a rare circumstance, but that value is a uri, not necessarily a github address, so it is a bug. Not huge, but a minor annoyance.

It'll show up for any uri that starts with [email protected] and not [email protected]: or https://github.com and not https://github.com/.

Activity

  1. shua commented on Jan 31, 2019

    @shua
    Author

    I'm a little confused at the logic here:
    https://github.com/spring-projects/sts4/blob/master/headless-services/concourse-language-server/src/main/java/org/springframework/ide/vscode/concourse/github/GithubValueParsers.java#L90
    and why it's not just a simple:

    if(str.startsWith(expectedPrefix)) {
      return expectedPrefix;
    }
    

    is it an attempt to guess what the user meant and give some better suggestion for a common error? How common is it to mess up a github address in that specific way? Everything is right except the ':' or '/' missing?

  2. kdvolder commented on Jan 31, 2019

    @kdvolder
    Member

    The logic is just written because we have some special support for github addresses. (It does more than just check the format, but actually uses github rest api, provided you have it setup correctly, to verify the repo exists, it also gives some completion support for repo names etc.).

    We (or better, blame that on me personally, who wrote this code) just didn't think much about the other cases.

    And no, obviously it isn't correct or logical. But isn't that usually the case when there is a bug? I mean if it was correct and logical then it wouldn't be a bug, would it now :-).

    Anyhow, thanks for reporting, it shouldn't be too hard to fix.

  3. shua commented on Jan 31, 2019

    @shua
    Author

    neat, thanks. I can take a stab at it if you'd like. Just need to know what's expected.

  4. added a commit that references this issue on Jan 31, 2019
  5. kdvolder commented on Jan 31, 2019

    @kdvolder
    Member

    @shua

    I can take a stab at it if you'd like.

    Thanks for the generous offer. I already pushed a small change that I think fixes it so your urls no longer get flagged. But we still detect that something like this: [email protected]/spring-projects/sts4.git is wrong. Basically I just added a extra condition so the error is not raised if the character after the 'github.com' is not a '/' or ':'. Turns out this does have a common mistake in mind. I.e. mixing up whether the 'separator' is ':' (for ssh style) or a '/' (for https style).

  6. kdvolder commented on Jan 31, 2019

    @kdvolder
    Member
  7. added this to the 4.1.2.RELEASE milestone on Feb 1, 2019
  8. shua commented on Feb 1, 2019

    @shua
    Author

    thanks, tried it out, and it looks like it's fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions