Fix regex parsing in artifact-provider

This commit is contained in:
Michal Dorner 2021-02-15 16:15:21 +01:00
parent 075144b122
commit 064a15c405
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
3 changed files with 9 additions and 3 deletions

5
dist/index.js generated vendored
View file

@ -45,7 +45,10 @@ class ArtifactProvider {
this.sha = sha; this.sha = sha;
this.runId = runId; this.runId = runId;
if (this.artifact.startsWith('/')) { if (this.artifact.startsWith('/')) {
const re = new RegExp(this.artifact); const endIndex = this.artifact.lastIndexOf('/');
const rePattern = this.artifact.substring(1, endIndex);
const reOpts = this.artifact.substring(endIndex + 1);
const re = new RegExp(rePattern, reOpts);
this.artifactNameMatch = (str) => re.test(str); this.artifactNameMatch = (str) => re.test(str);
this.getReportName = (str) => { this.getReportName = (str) => {
const match = str.match(re); const match = str.match(re);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -22,7 +22,10 @@ export class ArtifactProvider implements InputProvider {
readonly runId: number readonly runId: number
) { ) {
if (this.artifact.startsWith('/')) { if (this.artifact.startsWith('/')) {
const re = new RegExp(this.artifact) const endIndex = this.artifact.lastIndexOf('/')
const rePattern = this.artifact.substring(1, endIndex)
const reOpts = this.artifact.substring(endIndex + 1)
const re = new RegExp(rePattern, reOpts)
this.artifactNameMatch = (str: string) => re.test(str) this.artifactNameMatch = (str: string) => re.test(str)
this.getReportName = (str: string) => { this.getReportName = (str: string) => {
const match = str.match(re) const match = str.match(re)