Skip to content

Commit

Permalink
fix: Split on == and ~= for requirements.txt (#185)
Browse files Browse the repository at this point in the history
* Splittttt

* Iq trailing slash part 2 electric boogalo (#184)

* fix: handled case where trailing slash is in the IQ endpoint setting leading to an invalid report url

* put it up top in the constructor

* changed string casting in iq component model constructor and joined report url using the URL object

Co-authored-by: Artemie Jurgenson <[email protected]>
  • Loading branch information
DarthHater and ButterB0wl authored Feb 12, 2021
1 parent 93ce282 commit b288252
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions ext-src/models/IqComponentModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ export class IqComponentModel implements ComponentModel {
constructor(
options: ComponentModelOptions
) {
this.applicationPublicId = options.configuration.get(NEXUS_IQ_PUBLIC_APPLICATION_ID) + "";
// remove trailing slash if it exists
this.url = String(options.configuration.get(NEXUS_IQ_SERVER_URL)).replace(/\/$/, "");
const username = options.configuration.get(NEXUS_IQ_USERNAME) + "";
this.applicationPublicId = options.configuration.get(NEXUS_IQ_PUBLIC_APPLICATION_ID) as string;
this.url = options.configuration.get(NEXUS_IQ_SERVER_URL) as string;
const username = options.configuration.get(NEXUS_IQ_USERNAME) as string;
// this one is converted rather than cast as string
const maximumEvaluationPollAttempts = parseInt(
options.configuration.get(NEXUS_IQ_MAX_EVAL_POLL_ATTEMPTS) + "", 10);
const password = options.configuration.get(NEXUS_IQ_USER_PASSWORD) + "";
String(options.configuration.get(NEXUS_IQ_MAX_EVAL_POLL_ATTEMPTS)), 10);
const password = options.configuration.get(NEXUS_IQ_USER_PASSWORD) as string;
const strictSSL = options.configuration.get(NEXUS_IQ_STRICT_SSL) as boolean;

this.requestService = new IqRequestService(this.url, username, password, maximumEvaluationPollAttempts, strictSSL, options.logger);
Expand Down Expand Up @@ -181,7 +181,7 @@ export class IqComponentModel implements ComponentModel {
resolve();
}).then(() => {
if (!this.reportUrl.startsWith(this.url)) {
this.reportUrl = `${this.url}/${this.reportUrl}`;
this.reportUrl = new URL(this.reportUrl, this.url).href
}

window.showInformationMessage(`Nexus IQ Server Results in, build with confidence!\n Report available at: ${this.reportUrl}`);
Expand Down
2 changes: 1 addition & 1 deletion ext-src/packages/pypi/PyPiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class PyPiUtils {
console.debug("Found comment, skipping");
} else {
// remove any conditionals after semicolon, split result to get package and version
const dependencyParts: string[] = dep.split(";")[0].trim().split("==");
const dependencyParts: string[] = dep.split(";")[0].trim().split(/==|~=/);
if (!dependencyParts || dependencyParts.length != 2) {
// Short circuit, we couldn't split, move on to next one
return;
Expand Down

0 comments on commit b288252

Please sign in to comment.