diff --git a/src/domains/models/SpecificationFile.ts b/src/domains/models/SpecificationFile.ts index 5370f6e67..c14fb4eed 100644 --- a/src/domains/models/SpecificationFile.ts +++ b/src/domains/models/SpecificationFile.ts @@ -237,7 +237,7 @@ export async function fileExists(name: string): Promise { return true; } - const extension = name.split('.')[1]; + const extension = name.includes('.') ? name.split('.').pop() : ''; const allowedExtenstion = ['yml', 'yaml', 'json']; diff --git a/src/domains/services/validation.service.ts b/src/domains/services/validation.service.ts index 11ac45fc4..e2c9f4cb7 100644 --- a/src/domains/services/validation.service.ts +++ b/src/domains/services/validation.service.ts @@ -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) {