WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@aliraza556
Copy link

@aliraza556 aliraza556 commented Jul 24, 2025

Issue

When creating prompts with names containing special characters (like slashes, colons, or question marks) through the UI, the Python client fails to fetch them due to improper URL encoding. This causes 404 errors when the special characters are interpreted as path separators instead of being treated as part of the name.

Root Cause

The quote() function from urllib.parse was being used without the safe='' parameter, which meant certain characters (especially forward slashes) were not being encoded in the URL path.

Solution

  • Modified get_prompt_template and aget_prompt_template functions to use quote(prompt_name, safe='') to encode ALL special characters
  • Applied the same fix to _resolve_workflow_id function for consistent behavior
  • Added a test file to verify proper URL encoding of special characters

Testing

Created test cases for different special characters:

  • Forward slashes (/) → encoded as %2F
  • Colons (:) → encoded as %3A
  • Question marks (?) → encoded as %3F

#Closed: #254

This fix enables users to create and fetch prompts with hierarchical naming schemes like "feature1/resolve_problem_2" without running into 404 errors.

@aliraza556
Copy link
Author

@dali-fathallah Please review this PR.

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