Skip to content

catch undefined absolut URI#205

Merged
bourgeoa merged 3 commits intomainfrom
fix/issue#204
Mar 8, 2026
Merged

catch undefined absolut URI#205
bourgeoa merged 3 commits intomainfrom
fix/issue#204

Conversation

@bourgeoa
Copy link
Contributor

@bourgeoa bourgeoa commented Mar 8, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 8, 2026 16:10
@bourgeoa bourgeoa enabled auto-merge March 8, 2026 16:10
@bourgeoa bourgeoa disabled auto-merge March 8, 2026 16:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens type index loading/derivation by validating that URIs are absolute http(s) URLs before using them, and by skipping malformed community entries instead of throwing.

Changes:

  • Add isAbsoluteHttpUri() helper and apply it to community nodes before loading their type indexes.
  • Add try/catch around per-community loadTypeIndexesFor so a single failing community doesn’t break the whole operation.
  • Tighten docDirUri() / type index suggestion logic to only accept absolute http(s) URIs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 168 to 170
const dirUri = docDirUri(preferencesFile)
if (!dirUri) throw new Error(`suggestPrivateTypeIndex: Cannot derive directory for ${preferencesFile.uri}`)
if (!dirUri || !isAbsoluteHttpUri(dirUri)) throw new Error(`suggestPrivateTypeIndex: Cannot derive directory for ${preferencesFile.uri}`)
return sym(dirUri + 'privateTypeIndex.ttl')
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same redundancy as above: docDirUri() already filters to absolute http(s) URIs, so re-checking isAbsoluteHttpUri(dirUri) here duplicates the validation logic.

Copilot uses AI. Check for mistakes.
@bourgeoa bourgeoa merged commit 49a9fc7 into main Mar 8, 2026
5 checks passed
@bourgeoa bourgeoa linked an issue Mar 8, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

catch undefinedpublicTypeIndex.ttl

2 participants