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:', '')
shareDescription = \
urllib.parse.unquote_plus(shareDescription.strip())
shareDescription = shareDescription.replace('_', ' ')
self.path = self.path.split('?replydm=')[0]+'/newdm'
if self.server.debug:
print('DEBUG: replydm path ' + self.path)

View File

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

View File

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