Url parsing

main
Bob Mottram 2020-04-15 12:10:30 +01:00
parent 167b7926fd
commit e6991c8ac0
2 changed files with 3 additions and 4 deletions

View File

@ -14,6 +14,7 @@ except ImportError:
from Crypto.PublicKey import RSA from Crypto.PublicKey import RSA
from Crypto.Util import number from Crypto.Util import number
import os import os
import urllib.parse
from session import getJson from session import getJson
from cache import storeWebfingerInCache from cache import storeWebfingerInCache
from cache import getWebfingerFromCache from cache import getWebfingerFromCache
@ -220,8 +221,7 @@ def webfingerLookup(path: str, baseDir: str,
else: else:
if 'resource=acct%3A' in path: if 'resource=acct%3A' in path:
handle = path.split('resource=acct%3A')[1] handle = path.split('resource=acct%3A')[1]
handle = handle.replace('%40', '@', 1) handle = urllib.parse.unquote(handle.strip())
handle = handle.replace('%3A', ':', 1).strip()
if debug: if debug:
print('DEBUG: WEBFINGER handle ' + handle) print('DEBUG: WEBFINGER handle ' + handle)
if not handle: if not handle:

View File

@ -273,8 +273,7 @@ def htmlSearchSharedItems(translate: {},
currPage = 1 currPage = 1
ctr = 0 ctr = 0
sharedItemsForm = '' sharedItemsForm = ''
searchStrLower = searchStr.replace('%2B', '+').replace('%40', '@') searchStrLower = urllib.parse.unquote(searchStr)
searchStrLower = searchStrLower.replace('%3A', ':').replace('%23', '#')
searchStrLower = searchStrLower.lower().strip('\n') searchStrLower = searchStrLower.lower().strip('\n')
searchStrLowerList = searchStrLower.split('+') searchStrLowerList = searchStrLower.split('+')
cssFilename = baseDir + '/epicyon-profile.css' cssFilename = baseDir + '/epicyon-profile.css'