Skip to content

isRepoRoot Fails on https://github.com/Witold101/wpw #24

Closed

Description

@yakov116

https://github.com/Witold101/wpw

I can't figure out why. Maybe because the username start with an upper case letter? but in this repo we are not doing .toLowercase()??

Activity

  1. notlmn commented on Jul 13, 2020

    @notlmn
    Contributor

    Both repo and usernames are case-insensitive as far as GitHub is considered.

    getRepoURL() and similar getters should no convert to other cases while returning, instead that should be left to functions like isRepoRoot().

    Example:

    function isRepoRoot() {
    	// ...
    	return document.title.toLowerCase().startsWith(getRepoURL().toLowerCase()) && ...
    }
  2. notlmn commented on Jul 13, 2020

    @notlmn
    Contributor

    Looks like link[rel="alternative"] can betray you sometimes too. There is stuff like meta[name="go-import"] and other analytics tags.

    image

  3. yakov116 commented on Jul 13, 2020

    @yakov116
    MemberAuthor

    select.last

  4. added
    bug
    help wanted
    on Jul 13, 2020
  5. yakov116 commented on Jul 20, 2020

    @yakov116
    MemberAuthor

    Figured it out.
    https://github.com/fregante/github-url-detection/blob/91f020d54264ecd443e80e6d2cc4e6c1943725f6/index.ts#L298

    On is repoRoot we want to make sure we are not on the home so we detect is the title matches (so I think). However if the repo does not have a description the the title will match.

    Example:
    This repo: "fregante/github-url-detection: Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript."
    Witold101/wpw: "Witold101/wpw"

    Not sure how to go about it

  6. fregante commented on Jul 22, 2020

    @fregante
    Member

    How does my PR look?

  7. yakov116 commented on Jul 22, 2020

    @yakov116
    MemberAuthor

    @fregante your pr's always look good 😁

    I am away from the computer for the next while I will test it and let you know.

  8. fregante commented on Jul 23, 2020

    @fregante
    Member

    @notlmn we can use rel=canonical inside getRepoURL IF url isn't specified, but that doesn't appear on every page.

    og:url seems to appear on every page: #26

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

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions