ebmdatalab / thedatalab

The Datalab's website
https://www.thedatalab.org
1 stars 1 forks source link

Fixup bad email links in content #45

Closed madwort closed 3 years ago

madwort commented 3 years ago

Fix links in content that don't render correctly.


-- Find some duff links
SELECT COUNT(*) FROM frontend_blog WHERE body LIKE '%(hello@ebmdatalab.net)%';
SELECT COUNT(*) FROM frontend_blog WHERE body LIKE '%<hello@ebmdatalab.net>%';
SELECT COUNT(*) FROM frontend_blog WHERE body LIKE '%(feedback@openprescribing.net)%';
SELECT COUNT(*) FROM frontend_blog WHERE body LIKE '%(ebmdatalab@phc.ox.ac.uk)%';

-- Fix the duff links
UPDATE frontend_blog SET body = REPLACE(body, '(hello@ebmdatalab.net)', '(mailto:ebmdatalab@phc.ox.ac.uk)') WHERE body LIKE '%(hello@ebmdatalab.net)%';
UPDATE frontend_blog SET body = REPLACE(body, '<hello@ebmdatalab.net>', '<ebmdatalab@phc.ox.ac.uk>') WHERE body LIKE '%<hello@ebmdatalab.net>%';
UPDATE frontend_blog SET body = REPLACE(body, '(ebmdatalab@phc.ox.ac.uk)', '(mailto:ebmdatalab@phc.ox.ac.uk)') WHERE body LIKE '%(ebmdatalab@phc.ox.ac.uk)%';
UPDATE frontend_blog SET body = REPLACE(body, '(feedback@openprescribing.net)', '(mailto:feedback@openprescribing.net)') WHERE body LIKE '%(feedback@openprescribing.net)%';
madwort commented 3 years ago

oh, also, web links in angle brackets:

SELECT COUNT(*) FROM frontend_blog WHERE body LIKE '%<OpenPathology.net>%';
UPDATE frontend_blog SET body = REPLACE(body, '<OpenPathology.net>', '[OpenPathology.net](http://OpenPathology.net)') WHERE body LIKE '%<OpenPathology.net>%';