Skip to content

Commit

Permalink
Fixed the Cannot read property 'host' of undefined issue when only on…
Browse files Browse the repository at this point in the history
…e site is available
  • Loading branch information
kasunkv committed May 12, 2018
1 parent ef0c11c commit 65e7ebe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .taskkey
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cca8c7a9-9e4f-4e4b-8397-bae8755b7cf2
8eb12ee0-acf7-4d11-a6dc-be4d079a03fa
3 changes: 2 additions & 1 deletion BuildTask/OwaspZapScan/classes/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export class Helper {
}

const reportJson: ScanReport = res;
const sites: Site[] = reportJson.OWASPZAPReport.site;
const siteCollection: any = reportJson.OWASPZAPReport.site;
const sites: Site[] = Object.keys(siteCollection)[0] === '0' ? siteCollection : [siteCollection as Site];

for (const idx in sites) {
if (targetUrl.includes(sites[idx].$.host)) {
Expand Down
2 changes: 1 addition & 1 deletion BuildTask/OwaspZapScan/interfaces/types/ZapReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface ScanReport {
}

export interface OwaspZapReport {
site: Array<Site>;
site: Site[];
$: { version: string, generated: string };
}

Expand Down

0 comments on commit 65e7ebe

Please sign in to comment.