I have defined a Flask route as follows:
@app.route('/upload/from_url/<url:string>')
def upload_from_url(url: str) -> str:
return {'url': url}
I also tried the route with <url>
only. In any case, the route doesn't match if it contains a URL encoded slash. For example, this fails:
https://example.com/upload/from_url/https%3A%2F%2Fgithub.com
Whereas this one works:
https://example.com/upload/from_url/github.com
I am confused why Flask would decode the URL before attempting to match, that seems to defeat the purpose of the encoding.
What's the right way to approach this?