I have the following code in my template HTML page:
<form class="ui form" action="{{ url_for('download_pdf', text=original_text) }}" method="get">
<button class="ui left floated submit button" type="submit">Export</button>
</form>
In this code, the original_text
variable was passed to this template from within python and I am trying to pass it to another python function as:
@app.route("/download-pdf/<text>")
def download_pdf(text: str):
data = text
return render_template("success.html", data=data)
Now, this results in 404
not found error. It is trying to render it as:
https://page.net/download-pdf/He%20...long text here with spaces...?
If I do something like:
<form class="ui form" action="{{ url_for('download_pdf', text='hello') }}"
it seems to work.