Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/domains/models/SpecificationFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@
return true;
}

const extension = name.split('.')[1];
const parts = name.split('.');
const extension = parts.length > 1 ? parts[parts.length - 1] : '';

Check warning on line 241 in src/domains/models/SpecificationFile.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `.at(…)` over `[….length - index]`.

See more on https://sonarcloud.io/project/issues?id=asyncapi_cli&issues=AZ52UYeE47GWV_L6SIoN&open=AZ52UYeE47GWV_L6SIoN&pullRequest=2221

const allowedExtenstion = ['yml', 'yaml', 'json'];

Expand Down
2 changes: 1 addition & 1 deletion src/domains/services/validation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const convertGitHubWebUrl = (url: string): string => {

// Handle GitHub web URLs like: https://github.com/owner/repo/blob/branch/path
// eslint-disable-next-line no-useless-escape
const githubWebPattern = /^https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/blob\/([^\/]+)\/(.+)$/;
const githubWebPattern = /^https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/blob\/(.+?)\/(.+)$/;
const match = urlWithoutFragment.match(githubWebPattern);

if (match) {
Expand Down
Loading