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

Repository name capturing from remote is wrong #65

Open
fancywriter opened this issue Jun 24, 2022 · 4 comments
Open

Repository name capturing from remote is wrong #65

fancywriter opened this issue Jun 24, 2022 · 4 comments
Labels

Comments

@fancywriter
Copy link

I have repository in Gitlab called [email protected]:org/group/subgroup/project.git.
When trying to use the plugin with releases configuration I am bad request from Sentry with similar message

{"refs":["Invalid repository names: subgroup / project"]}

Seems it's because of regular expression here

let repository = /[:/]([^/]+\/[^/]+?)(?:\.git)?$/i.exec(origin)?.[1];

I am not sure what was the motivation for such capturing group as ([^/]+\/[^/]+?), so me just putting (.+?) is enough and works... this expression allows only one / symbol, though it may be few of them in between. What I need is to extract full repository name like org/group/subgroup/project.

Is it a bug? Seems that putting repository name manually into serverless.yaml fixes it.

@arabold
Copy link
Owner

arabold commented Jun 24, 2022

Indeed, this probably is a bug. The original code is several years old and I assume the format used by GitLab has slightly changed over time. I don't see why we would need to limit the number of slashes (/) in the repository name... The code lines after, that removes blank spaces around the slash is probably not needed anymore either, is it?

Do you have some availability to submit a PR for review? Otherwise I'll see when I get to it in the next few weeks, as I have currently no way of testing changes to the plugin with GitLab.

@arabold arabold added the bug label Jun 24, 2022
@fancywriter
Copy link
Author

Yes, definitely, why not, it's one-liner - I just not sure if (.+?) proper way to go, it worked for me, but probably there was a good reason and I missed some corner cases?..

fancywriter added a commit to fancywriter/serverless-sentry-plugin that referenced this issue Jun 24, 2022
fancywriter added a commit to fancywriter/serverless-sentry-plugin that referenced this issue Jun 24, 2022
@fridaystreet
Copy link

yep having this issue too. will have a play with the regex and post a PR if have any luck

@fridaystreet
Copy link

actually just realised getting the same erro, but i'm using git and it's not putting the spaces around the slash only for gitlab. is git the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants