Hello, I recently updated an app: Since web2py Version 2.19.1-stable+timestamp.2020.03.21.13.06.49 and Python 3.6.8 A web2py latest version in Master at the end of 2021 (Version 2.21.2-stable+timestamp.2021.10.15.07.44.23) and python 3.8
Everything seemed to work perfectly. Now I have noticed that the forms with 'upload' fields are not working well. Actually the form seems to work fine and what doesn't work is the download of the image. The problem only occurs when I have the following in the routes.py file: routers = dict( BASE=dict( default_application='myapp', ), ) In this situation, all requests for uploaded images return a 400 Bad Request error. *With almost all jpg files I have problems, but for example if the image is called ff.jpg it works fine...* I have traced the error to the file gluon.rewrite.py line above line1221: def validate_args(self): """ Checks args against validation pattern """ for arg in self.args: if not self.router._args_match.match(arg): raiseHTTP( 400, THREAD_LOCAL.routes.error_message % "invalid request", web2py_error="invalid arg <%s>" % arg, ) If I delete the routes.py file everything works fine. But I need myapp as the default app. Example of the problem with a clean install downloaded from github: models db.define_table( 't_upload', Field('f_upload_img', 'upload'), ) Controller upload.py def upload_img(): record = db(db.t_upload).select().first() form = SQLFORM( db.t_upload, record, upload=URL('default', 'download') ) if form.process(keepvalues=True).accepted: redirect(URL()) return dict(form=form) *With myapp as default application*: http://127.0.0.1:8081/upload_img seems to work, but http://127.0.0.1:8000/download/t_upload.f_upload_img.bba19b6c318b6379.YmwxNTYxODI5Mzg3MTkzNi5qcGc=.jpg *returns 400 bad request* *Deleting router.py* http://127.0.0.1:8000/pyapp/upload/upload_img works fine and http://127.0.0.1:8000/pyapp/default/download/t_upload.f_upload_img.ae2d38ca06c81a3d.YmwxNTYxODI5Mzg3MTkzNi5qcGc=.jpg *returns the image* Has anyone had this problem? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/90bf9749-0a7f-413c-80c3-99a130073f09n%40googlegroups.com.