From f8fe2753b125c6882019d1ba2c2db661b0bdcbf2 Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Wed, 5 Mar 2014 15:41:28 +0100
Subject: [PATCH] Added localhost as trusted domain

---
 lib/private/request.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/private/request.php b/lib/private/request.php
index fb387e83e3..347d77b372 100755
--- a/lib/private/request.php
+++ b/lib/private/request.php
@@ -13,6 +13,8 @@ class OC_Request {
 	const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#';
 	const USER_AGENT_FREEBOX = '#^Mozilla/5\.0$#';
 
+	const REGEX_LOCALHOST = '/^(127\.0\.0\.1|localhost)(:[0-9]+|)$/';
+
 	/**
 	 * @brief Check overwrite condition
 	 * @param string $type
@@ -38,6 +40,9 @@ class OC_Request {
 		if (empty($trustedList)) {
 			return true;
 		}
+		if (preg_match(self::REGEX_LOCALHOST, $domain) === 1) {
+			return true;
+		}
 		return in_array($domain, $trustedList);
 	}
 
-- 
GitLab