arabold / serverless-sentry-plugin

This plugin adds automatic forwarding of errors and exceptions to Sentry (https://sentry.io) and Serverless (https://serverless.com)
MIT License
155 stars 27 forks source link

Repository name capturing from remote is wrong #65

Open fancywriter opened 2 years ago

fancywriter commented 2 years ago

I have repository in Gitlab called git@gitlab.com: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.

arabold commented 2 years ago

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.

fancywriter commented 2 years ago

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?..

fridaystreet commented 11 months ago

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

fridaystreet commented 11 months ago

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?