Skip to content

Fix slash handling in prompt template path segments#320

Open
chriszlr wants to merge 1 commit into
MagnivOrg:masterfrom
chriszlr:fix-slash-prompt-template-paths
Open

Fix slash handling in prompt template path segments#320
chriszlr wants to merge 1 commit into
MagnivOrg:masterfrom
chriszlr:fix-slash-prompt-template-paths

Conversation

@chriszlr
Copy link
Copy Markdown

Closes #254

Summary

  • Add a shared API path-segment encoder that double-encodes / while preserving normal URL quoting for other special characters.
  • Use it for sync/async prompt template fetches and workflow-name resolution.
  • Update regression tests so slash-containing names survive one edge/proxy decode pass before routing.

Why

A plain %2F path segment still gets decoded before routing and returns a 404 for prompt-templates/feature1%2Fresolve_problem_2. Double-encoding the slash reaches the PromptLayer endpoint instead; with an invalid API key it returns the expected auth error rather than route-level 404.

Verification

  • uv run python -m pytest tests/test_get_prompt_template.py tests/test_agents/test_arun_workflow_request.py -q
  • uv run python -m pytest -q
  • uv run ruff check promptlayer/utils.py tests/test_get_prompt_template.py tests/test_agents/test_arun_workflow_request.py
  • uv run ruff format --check promptlayer/utils.py tests/test_get_prompt_template.py tests/test_agents/test_arun_workflow_request.py

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.

Client fails to fetch prompts with names containing slash

1 participant