diff --git a/webapp_post.py b/webapp_post.py
index 50714519c..89ef5b8e3 100644
--- a/webapp_post.py
+++ b/webapp_post.py
@@ -3183,16 +3183,28 @@ def individual_post_as_html(signing_priv_key_pem: str,
buy_links = get_buy_links(post_json_object, translate, buy_sites)
# show embedded map if the location contains a map url
location_str = get_location_from_post(post_json_object)
+ loc_str = location_str
if location_str:
- if resembles_url(location_str):
+ # if this is a location with an address then remove the address
+ if '
' in location_str:
+ loc_str = location_str.split('
')[0]
+ # does this look like a geolocation link?
+ if resembles_url(loc_str):
bounding_box_degrees = 0.001
map_str = \
- html_open_street_map(location_str,
+ html_open_street_map(loc_str,
bounding_box_degrees,
translate, session,
session, session)
if map_str:
- map_str = '\n' + map_str + '\n'
+ map_addr_str = ''
+ if '
' in location_str:
+ # append the address after the map
+ map_addr_str = \
+ '
' + \
+ location_str.split('
')[1] + '\n'
+ map_str = '\n' + map_str + \
+ map_addr_str + '\n'
attrib = None
if post_json_object['object'].get('attributedTo'):
attrib = \
@@ -3200,13 +3212,13 @@ def individual_post_as_html(signing_priv_key_pem: str,
if map_str and attrib:
# is this being sent by the author?
if '://' + domain_full + '/users/' + nickname in attrib:
- location_domain = location_str
- if '://' in location_str:
- location_domain = location_str.split('://')[1]
+ location_domain = loc_str
+ if '://' in loc_str:
+ location_domain = loc_str.split('://')[1]
if '/' in location_domain:
location_domain = location_domain.split('/')[0]
location_domain = \
- location_str.split('://')[0] + '://' + location_domain
+ loc_str.split('://')[0] + '://' + location_domain
else:
if '/' in location_domain:
location_domain = location_domain.split('/')[0]
@@ -3216,7 +3228,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
location_domain)
# remember the coordinates
map_zoom, map_latitude, map_longitude = \
- geocoords_from_map_link(location_str,
+ geocoords_from_map_link(loc_str,
'openstreetmap.org',
session)
if map_zoom and map_latitude and map_longitude: