Skip to content

lsp/uri: Refactor URI handling#1644

Merged
charlieegan3 merged 1 commit intoopen-policy-agent:mainfrom
charlieegan3:to-path-refactor
Aug 5, 2025
Merged

lsp/uri: Refactor URI handling#1644
charlieegan3 merged 1 commit intoopen-policy-agent:mainfrom
charlieegan3:to-path-refactor

Conversation

@charlieegan3
Copy link
Copy Markdown
Contributor

This had been botched some time back and can be made simpler.

@charlieegan3 charlieegan3 force-pushed the to-path-refactor branch 2 times, most recently from 587594e to b9fcd6f Compare August 5, 2025 12:59
Copy link
Copy Markdown
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment thread internal/lsp/uri/uri.go
path, hadPrefix := strings.CutPrefix(uri, "file://")
if hadPrefix {
// if it looks like a URI, then try and decode it
if decodedPath, err := url.QueryUnescape(path); err == nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why change this? 🙂 Seems like CutPrefix answers the same question in one function call instead of two, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah that makes sense. I'll keep that in there!

Comment thread log.txt
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should probably not be here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah I thought so too, so I've removed it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lol, my mistake!

This had been botched some time back and can be made simpler.

Signed-off-by: Charlie Egan <charlie@styra.com>
@charlieegan3 charlieegan3 merged commit 15ae9a8 into open-policy-agent:main Aug 5, 2025
6 checks passed
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.

2 participants