Handle @ paths with status number

main
Bob Mottram 2021-02-13 23:31:38 +00:00
parent 5257cfe2c8
commit 7f8b55a62e
1 changed files with 10 additions and 0 deletions

View File

@ -10051,6 +10051,16 @@ class PubServer(BaseHTTPRequestHandler):
# replace https://domain/@nick with https://domain/users/nick
if self.path.startswith('/@'):
self.path = self.path.replace('/@', '/users/')
# replace https://domain/@nick/statusnumber
# with https://domain/users/nick/statuses/statusnumber
nickname = self.path.split('/users/')[1]
if '/' in nickname:
statusNumberStr = nickname.split('/')[1]
if statusNumberStr.isdigit():
nickname = nickname.split('/')[0]
self.path = \
self.path.replace('/users/' + nickname + '/',
'/users/' + nickname + '/statuses/')
# turn off dropdowns on new post screen
noDropDown = False