Skip to content

Fix URL-decoding of file:// URI paths in _resolve_model_path()#65

Closed
Copilot wants to merge 1 commit intoopenstudio_mcpfrom
copilot/sub-pr-63-again
Closed

Fix URL-decoding of file:// URI paths in _resolve_model_path()#65
Copilot wants to merge 1 commit intoopenstudio_mcpfrom
copilot/sub-pr-63-again

Conversation

Copy link

Copilot AI commented Mar 2, 2026

_resolve_model_path() used urlparse(...).path directly without decoding percent-encoded characters, causing Path.exists() to fail for URIs with spaces or other special characters (e.g., file:///my%20models/foo.osm).

Changes

  • openstudio_mcp_server/server.py: Added unquote to the urllib.parse import and applied it to the parsed path before constructing Path:
# Before
parsed = urlparse(model_uri)
return Path(parsed.path).resolve()

# After
parsed = urlparse(model_uri)
decoded_path = unquote(parsed.path)
return Path(decoded_path).resolve()

This ensures paths generated by Path(...).as_uri() (which percent-encodes characters) round-trip correctly back to a valid filesystem path.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI mentioned this pull request Mar 2, 2026
Copilot AI changed the title [WIP] WIP address feedback from PR #63 on mcp demo implementation Fix URL-decoding of file:// URI paths in _resolve_model_path() Mar 2, 2026
@weilixu weilixu closed this Mar 2, 2026
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