fix: double-encode forward slashes in API path segments for prompt names with slashes#1
Open
neuralmint wants to merge 1 commit into
Open
fix: double-encode forward slashes in API path segments for prompt names with slashes#1neuralmint wants to merge 1 commit into
neuralmint wants to merge 1 commit into
Conversation
When a prompt name (or workflow name) contains a forward slash, the edge proxy decodes %2F before routing the path parameter, causing the request to hit the wrong endpoint. Double-encoding slashes as %252F ensures they survive one decode pass and arrive at the application as %2F. Changes: - Add _quote_api_path_segment() helper that encodes all special chars and double-encodes forward slashes (%2F → %252F) - Apply helper in get_prompt_template, aget_prompt_template, and _resolve_workflow_id - Add unit tests for the helper and integration-style tests for the three call sites Closes MagnivOrg#254
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes MagnivOrg#254
Problem
When a prompt name contains a forward slash (e.g. feature1/resolve_problem_2), the Python client fails to fetch it because the unencoded slash creates a new path segment in the URL.
The PromptLayer edge proxy decodes %2F once before routing, so single-encoded slashes still break. Double-encoding as %252F ensures slashes survive proxy decode.
Changes