Skip to content

Commit

Permalink
Merge pull request #78 from golnazads/master
Browse files Browse the repository at this point in the history
replace spaces in url if any with encoded value
  • Loading branch information
golnazads committed Jul 26, 2021
2 parents fa396a7 + 9b2d085 commit 1c7683a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Empty file removed resolverway/templates/__init__.py
Empty file.
3 changes: 2 additions & 1 deletion resolverway/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def __init__(self, bibcode, link_type, url=None, id=None):

def redirect(self, link):
# need to urlencode the bibcode only! (ie, 1973A&A....24..337S)
link = link.replace(self.bibcode, urllib.parse.quote(self.bibcode))
# also if there are any spaces encode those as well
link = link.replace(self.bibcode, urllib.parse.quote(self.bibcode)).replace(' ', '%20')
response = redirect(link, 302)
response.autocorrect_location_header = False
response.headers['user_id'] = self.user_id
Expand Down

0 comments on commit 1c7683a

Please sign in to comment.