[Pkg-owncloud-commits] [owncloud] 13/61: Verify whether the URL is valid
David Prévot
taffit at moszumanska.debian.org
Thu Jul 31 03:51:41 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 05301825e22f16c7553a5cd490452e35d38e6ac5
Author: Lukas Reschke <lukas at owncloud.org>
Date: Sun Jul 27 16:46:32 2014 +0200
Verify whether the URL is valid
Required for https://github.com/owncloud/mail/pull/100#issuecomment-50266017
@karlitschek Backport for stable6 and stable7 requested.
---
lib/private/util.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/private/util.php b/lib/private/util.php
index eea1942..67da7a2 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -1217,11 +1217,16 @@ class OC_Util {
/**
* @Brief Get file content via curl.
* @param string $url Url to get content
+ * @throws Exception If the URL does not start with http:// or https://
* @return string of the response or false on error
* This function get the content of a page via curl, if curl is enabled.
* If not, file_get_contents is used.
*/
public static function getUrlContent($url) {
+ if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
+ throw new Exception('$url must start with https:// or http://', 1);
+ }
+
if (function_exists('curl_init')) {
$curl = curl_init();
$max_redirects = 10;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list