Skip to content

Multiple question-marks in an URL

When I click the "newblog" button, I come to a page with a form action like this: /users/alex/newblog?newblog?page=1.

I think this is due to the following in webapp_create_post.py:

    newPostForm += \
        '<form enctype="multipart/form-data" method="POST" ' + \
        'accept-charset="UTF-8" action="' + \
        path + '?' + endpoint + '?page=' + str(pageNumber) + '">\n'

I'm suspecting that the problem is code like this:

    endpoint = 'newpost'
    if path.endswith('/newblog'):
        ...
        endpoint = 'newblog'

Can we drop the initial endpoint assignment and add something like this?

    else:
      path += '/newpost'
      endpoint = 'newpost'

In that case we would know that path is always good enough and we don't need to add '?' + endpoint up above.

Edited by Alex Schroeder