serverless-sentry-plugin icon indicating copy to clipboard operation
serverless-sentry-plugin copied to clipboard

Repository name capturing from remote is wrong

Open fancywriter opened this issue 3 years ago • 4 comments

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 https://github.com/arabold/serverless-sentry-plugin/blob/8c60ea5f9ddde97693b60e993ef05588158b5206/src/index.ts#L325

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.

fancywriter avatar Jun 24 '22 13:06 fancywriter

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 avatar Jun 24 '22 13:06 arabold

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 avatar Jun 24 '22 14:06 fancywriter

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

fridaystreet avatar Oct 23 '23 22:10 fridaystreet

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?

fridaystreet avatar Oct 23 '23 22:10 fridaystreet