Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: repo name is being empty #290

Open
1 of 2 tasks
a0m0rajab opened this issue Nov 18, 2023 · 1 comment
Open
1 of 2 tasks

Bug: repo name is being empty #290

a0m0rajab opened this issue Nov 18, 2023 · 1 comment
Labels
🐛 bug Something isn't working

Comments

@a0m0rajab
Copy link
Contributor

Describe the bug

Sometimes the repo name is being empty in the bubble chat in the extension. this is happening due the repo name detector logic we have in this line of code:

const repoName = window.___location.href.split("/").pop() ?? "";

This is happening when the URL has a slash at the end of it.

Steps to reproduce

  1. go to https://github.com/ahmadbilaldev/langui/
  2. check the network when you use the AI chat

Browsers

No response

Additional context (Is this in dev or production?)

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributing Docs

  • I agree to follow this project's Contribution Docs
@a0m0rajab a0m0rajab added 🐛 bug Something isn't working 👀 needs triage labels Nov 18, 2023
@nickytonline
Copy link
Member

nickytonline commented Nov 28, 2023

The problem is there is a trailing slash when you go to that link, e.g. https://github.com/ahmadbilaldev/langui/, so the only thing after the last slash is nothing which is why you end up with an empty string.

So we need to cover the use cases of when there is a trailing slash, and when there isn't. Also, you can use window.___location.pathname as that will give you e.g. /ahmadbilaldev/langui/ from https://github.com/ahmadbilaldev/langui/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants