Skip to content

Commit

Permalink
Handle different repos vnext namings
Browse files Browse the repository at this point in the history
  • Loading branch information
dobromirts committed Jun 24, 2024
1 parent 6374217 commit 5675e83
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/app/services/code-view/angular-code-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ export class AngularCodeService extends CodeService {

private getAngularGitHubSampleUrl(editor: string, sampleUrl: string, branch: string, demosBaseUrl: string) {
const dvSample = this.isDvSample(demosBaseUrl, sampleUrl);
if (util.isLocalhost) {
branch = dvSample ? 'vnext' : 'vNext';
}
const repositoryPath = dvSample ? 'igniteui-angular-examples/tree/' : 'igniteui-live-editing-samples/tree/';
if (editor === "stackblitz") return `https://stackblitz.com/github/IgniteUI/${repositoryPath}${branch}/${sampleUrl}`;
return `https://codesandbox.io/s/github/IgniteUI/${repositoryPath}${branch}/${sampleUrl}`;
Expand All @@ -152,7 +149,9 @@ export class AngularCodeService extends CodeService {
let demosBaseUrl = $codeView.attr(codeService.demosBaseUrlAttrName)!;
let sampleFileUrl = codeService.getGitHubSampleUrl(demosBaseUrl, $codeView.attr(codeService.sampleUrlAttrName)!, $codeView.attr(codeService.githubSrc)!);
let editor = $button.hasClass(codeService.stkbButtonClass) ? "stackblitz" : "codesandbox";
let branch = demosBaseUrl.indexOf("staging.infragistics.com") !== -1 ? "vNext" : "master";
const dvSample = this.isDvSample(demosBaseUrl, sampleFileUrl);
const stagingBranch = dvSample ? 'vnext' : 'vNext';
let branch = demosBaseUrl.indexOf("staging.infragistics.com") !== -1 ? stagingBranch : "master";

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
staging.infragistics.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
window.open(codeService.getAngularGitHubSampleUrl(editor, sampleFileUrl, branch, demosBaseUrl), '_blank');
codeService.isButtonClickInProgress = false;
}
Expand Down

0 comments on commit 5675e83

Please sign in to comment.