From cb228fe8dab265daba968d309036572967446ce7 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 6 Dec 2020 22:56:45 +0000
Subject: [PATCH] Avoid spaces in shared item description
---
daemon.py | 1 +
webapp_column_left.py | 5 ++++-
webapp_timeline.py | 26 ++++++++++++++------------
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/daemon.py b/daemon.py
index eb46e9e2..d34dfee5 100644
--- a/daemon.py
+++ b/daemon.py
@@ -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)
diff --git a/webapp_column_left.py b/webapp_column_left.py
index 54e7db72..589333b6 100644
--- a/webapp_column_left.py
+++ b/webapp_column_left.py
@@ -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
diff --git a/webapp_timeline.py b/webapp_timeline.py
index ada79436..526f37fc 100644
--- a/webapp_timeline.py
+++ b/webapp_timeline.py
@@ -627,18 +627,20 @@ def htmlIndividualShare(actor: str, item: {}, translate: {},
'' + translate['Category'] + ': ' + item['category'] + ' '
profileStr += \
'' + translate['Location'] + ': ' + item['location'] + '
\n'
- if showContact:
- contactActor = item['actor']
- profileStr += \
- '' + \
- translate['Contact'] + ' \n'
- if removeButton:
- profileStr += \
- ' ' + \
- translate['Remove'] + ' \n'
+ sharedesc = item['displayName']
+ if '<' not in sharedesc and '?' not in sharedesc:
+ if showContact:
+ contactActor = item['actor']
+ profileStr += \
+ '
' + \
+ translate['Contact'] + ' \n'
+ if removeButton:
+ profileStr += \
+ ' ' + \
+ translate['Remove'] + ' \n'
profileStr += '\n'
return profileStr