Avoid spaces in shared item description

merge-requests/8/head
Bob Mottram 2020-12-06 22:56:45 +00:00
parent 641eff191c
commit cb228fe8da
3 changed files with 19 additions and 13 deletions

View File

@ -10557,6 +10557,7 @@ class PubServer(BaseHTTPRequestHandler):
inReplyToUrl.replace('sharedesc:', '') inReplyToUrl.replace('sharedesc:', '')
shareDescription = \ shareDescription = \
urllib.parse.unquote_plus(shareDescription.strip()) urllib.parse.unquote_plus(shareDescription.strip())
shareDescription = shareDescription.replace('_', ' ')
self.path = self.path.split('?replydm=')[0]+'/newdm' self.path = self.path.split('?replydm=')[0]+'/newdm'
if self.server.debug: if self.server.debug:
print('DEBUG: replydm path ' + self.path) print('DEBUG: replydm path ' + self.path)

View File

@ -49,9 +49,12 @@ def getLeftColumnShares(baseDir: str,
ctr = 0 ctr = 0
for published, item in sharesJson.items(): for published, item in sharesJson.items():
sharedesc = item['displayName'] sharedesc = item['displayName']
if '<' in sharedesc or '?' in sharedesc:
continue
contactActor = item['actor'] contactActor = item['actor']
shareLink = actor + \ shareLink = actor + \
'?replydm=sharedesc:' + sharedesc + \ '?replydm=sharedesc:' + \
sharedesc.replace(' ', '_') + \
'?mention=' + contactActor '?mention=' + contactActor
linksList.append(sharedesc + ' ' + shareLink) linksList.append(sharedesc + ' ' + shareLink)
ctr += 1 ctr += 1

View File

@ -627,18 +627,20 @@ def htmlIndividualShare(actor: str, item: {}, translate: {},
'<b>' + translate['Category'] + ':</b> ' + item['category'] + ' ' '<b>' + translate['Category'] + ':</b> ' + item['category'] + ' '
profileStr += \ profileStr += \
'<b>' + translate['Location'] + ':</b> ' + item['location'] + '</p>\n' '<b>' + translate['Location'] + ':</b> ' + item['location'] + '</p>\n'
if showContact: sharedesc = item['displayName']
contactActor = item['actor'] if '<' not in sharedesc and '?' not in sharedesc:
profileStr += \ if showContact:
'<p><a href="' + actor + \ contactActor = item['actor']
'?replydm=sharedesc:' + item['displayName'] + \ profileStr += \
'?mention=' + contactActor + '"><button class="button">' + \ '<p><a href="' + actor + \
translate['Contact'] + '</button></a>\n' '?replydm=sharedesc:' + sharedesc + \
if removeButton: '?mention=' + contactActor + '"><button class="button">' + \
profileStr += \ translate['Contact'] + '</button></a>\n'
' <a href="' + actor + '?rmshare=' + item['displayName'] + \ if removeButton:
'"><button class="button">' + \ profileStr += \
translate['Remove'] + '</button></a>\n' ' <a href="' + actor + '?rmshare=' + sharedesc + \
'"><button class="button">' + \
translate['Remove'] + '</button></a>\n'
profileStr += '</div>\n' profileStr += '</div>\n'
return profileStr return profileStr