Skip to content

Commit

Permalink
feat: push targetFileRelativePath to registry payload
Browse files Browse the repository at this point in the history
  • Loading branch information
aviadhahami committed Jan 29, 2020
1 parent c52e45a commit c25a142
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/snyk-test/run-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as fs from 'fs';
import * as _ from 'lodash';
import * as path from 'path';
import * as debugModule from 'debug';
import * as pathUtil from 'path';
import * as moduleToObject from 'snyk-module';
import * as depGraphLib from '@snyk/dep-graph';

Expand Down Expand Up @@ -53,6 +54,7 @@ interface PayloadBody {
depGraph?: depGraphLib.DepGraph; // missing for legacy endpoint (options.vulnEndpoint)
policy: string;
targetFile?: string;
targetFileRelativePath?: string;
projectNameOverride?: string;
hasDevDependencies?: boolean;
originalProjectName?: string; // used only for display
Expand Down Expand Up @@ -353,9 +355,17 @@ async function assembleLocalPayloads(
const targetFile =
scannedProject.targetFile || deps.plugin.targetFile || options.file;

// Forcing options.path to be a string as pathUtil requires is to be stringified
const targetFileRelativePath = targetFile
? pathUtil.join(pathUtil.resolve(`${options.path}`), targetFile)
: '';

let body: PayloadBody = {
// WARNING: be careful changing this as it affects project uniqueness
targetFile: project.plugin.targetFile,

// TODO: Remove relativePath prop once we gather enough ruby related logs
targetFileRelativePath: `${targetFileRelativePath}`, // Forcing string
projectNameOverride: options.projectName,
originalProjectName: pkg.name,
policy: policy && policy.toString(),
Expand Down

0 comments on commit c25a142

Please sign in to comment.