Hi there! I noticed a change in behavior in werkzeug 0.15.x whereby url parameters used to be safe to send as bytes (on python 3.6).
I apologize for not showing a more direct example in werkzeug, but like most users of werkzeug - I don't use it directly - I use it through flask.
Demonstration (using Flask)
from flask import Flask, url_for
app = Flask(__name__)
app.config['SERVER_NAME'] = 'www.foo.com'
@app.route('/<string:foo>')
def hello(foo):
return 'Hello, World!'
with app.app_context():
print(url_for('hello', foo=b'bar'))
With werkzeug<0.15, this will output:
However as of werkzeug>=0.15, it now returns this malformed url:
http://www.foo.com/b%27bar%27
I would expect that if werkzeug isn't going to decode bytes for you anymore, that it ought to raise a TypeError indicating that bytes is no longer safe to pass in.
I hope this example makes sense! Thanks for reviewing my issue - I'd be happy to (attempt to) submit a pull request if y'all agree that this is not desirable behavior.
Hi there! I noticed a change in behavior in werkzeug 0.15.x whereby url parameters used to be safe to send as bytes (on python 3.6).
I apologize for not showing a more direct example in werkzeug, but like most users of werkzeug - I don't use it directly - I use it through flask.
Demonstration (using Flask)
With
werkzeug<0.15, this will output:However as of
werkzeug>=0.15, it now returns this malformed url:I would expect that if
werkzeugisn't going to decode bytes for you anymore, that it ought to raise aTypeErrorindicating thatbytesis no longer safe to pass in.I hope this example makes sense! Thanks for reviewing my issue - I'd be happy to (attempt to) submit a pull request if y'all agree that this is not desirable behavior.