From 0c956fabaa0cc741755c2de9ee65b0dcc5ef0b01 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Sun, 21 Feb 2016 00:14:51 +0000 Subject: [PATCH] In the case of a private paste, don't shorten the URL to prevent scraping Signed-off-by: Patrick Uiterwijk --- roles/paste/files/class_urlshort.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/paste/files/class_urlshort.php b/roles/paste/files/class_urlshort.php index cb1601168e..0657725d50 100644 --- a/roles/paste/files/class_urlshort.php +++ b/roles/paste/files/class_urlshort.php @@ -16,6 +16,9 @@ class URLShortener { public function shorten($long_url) { + if(preg_match('/^http(s)?:\/\/(.+).fedoraproject.org\/(\d+)\/(\d+)\/$/', $long_url)) { + return $long_url; + } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://ur1.ca/"); curl_setopt($ch, CURLOPT_POST, 1);