Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed URL while viewing article history #3

Open
carlgieringer opened this issue Nov 3, 2017 · 0 comments
Open

Malformed URL while viewing article history #3

carlgieringer opened this issue Nov 3, 2017 · 0 comments

Comments

@carlgieringer
Copy link
Member

The request URI (/article-history/https%25253A/www.nytimes.com/2017/08/27/us/politics/hurricane-trump-leadership.html) or path (/a/article-history/https%3A/www.nytimes.com/2017/08/27/us/politics/hurricane-trump-leadership.html) is messing up views.py#swap_http_https. Maybe URL decode the value?

Traceback (most recent call last):

  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/afs/sipb.mit.edu/contrib/newsdiffs/web_scripts/website/frontend/views.py", line 323, in article_history
    article = Article.objects.get(url=swap_http_https(url))

  File "/afs/sipb.mit.edu/contrib/newsdiffs/web_scripts/website/frontend/views.py", line 295, in swap_http_https
    raise ValueError("URL doesn't start with http or https")

ValueError: URL doesn't start with http or https


<WSGIRequest
path:/a/article-history/https%3A/www.nytimes.com/2017/08/27/us/politics/hurricane-trump-leadership.html,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'CONTEXT_DOCUMENT_ROOT': '/afs/sipb.mit.edu/contrib/newsdiffs/web_scripts/newsdiffs.org',
 'CONTEXT_PREFIX': '',
 'DOCUMENT_ROOT': '/afs/sipb.mit.edu/contrib/newsdiffs/web_scripts/newsdiffs.org',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate',
 'HTTP_CONNECTION': 'close',
 'HTTP_HOST': 'newsdiffs.org',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (compatible; YaK/1.0; http://linkfluence.com/; bot@linkfluence.com)',
 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin',
 'PATH_INFO': u'/article-history/https%3A/www.nytimes.com/2017/08/27/us/politics/hurricane-trump-leadership.html',
 'PATH_TRANSLATED': 'redirect:/mysite.fcgi/article-history/https%3A/www.nytimes.com/2017/08/27/us/politics/hurricane-trump-leadership.html/https%3A/www.nytimes.com/2017/08/27/us/politics/hurricane-trump-leadership.html',
 'QUERY_STRING': '',
 'REDIRECT_STATUS': '200',
 'REDIRECT_URL': '/article-history/https%253A/www.nytimes.com/2017/08/27/us/politics/hurricane-trump-leadership.html',
 'REMOTE_ADDR': '54.76.17.53',
 'REMOTE_PORT': '58288',
 'REQUEST_METHOD': 'GET',
 'REQUEST_SCHEME': 'http',
 'REQUEST_URI': '/article-history/https%25253A/www.nytimes.com/2017/08/27/us/politics/hurricane-trump-leadership.html',
 'SCRIPT_FILENAME': '/afs/sipb.mit.edu/contrib/newsdiffs/web_scripts/newsdiffs.org/mysite.fcgi',
 'SCRIPT_NAME': u'/a',
 'SERVER_ADDR': '18.181.0.46',
 'SERVER_ADMIN': 'scripts@mit.edu',
 'SERVER_NAME': 'newsdiffs.org',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SIGNATURE': '',
 'SERVER_SOFTWARE': 'Apache',
 'wsgi.errors': <flup.server.fcgi_base.OutputStream object at 0x7f1048070e90>,
 'wsgi.input': <flup.server.fcgi_base.InputStream object at 0x7f1048070950>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant