Code Duplication    Length = 9-9 lines in 2 locations

lib/controller/messagescontroller.php 1 location

@@ 227-235 (lines=9) @@
224
225
			// Harden the default security policy
226
			// FIXME: Remove once ownCloud 8.1 is a requirement for the mail app
227
			if(class_exists('\OCP\AppFramework\Http\ContentSecurityPolicy')) {
228
				$policy = new ContentSecurityPolicy();
229
				$policy->allowEvalScript(false);
230
				$policy->disallowScriptDomain('\'self\'');
231
				$policy->disallowConnectDomain('\'self\'');
232
				$policy->disallowFontDomain('\'self\'');
233
				$policy->disallowMediaDomain('\'self\'');
234
				$htmlResponse->setContentSecurityPolicy($policy);
235
			}
236
237
			// Enable caching
238
			$htmlResponse->cacheFor(60 * 60);

tests/controller/messagescontrollertest.php 1 location

@@ 133-141 (lines=9) @@
130
		$expectedResponse = new \OCA\Mail\Http\HtmlResponse(null);
131
		$expectedResponse->cacheFor(3600);
132
		$expectedResponse->addHeader('Pragma', 'cache');
133
		if(class_exists('\OCP\AppFramework\Http\ContentSecurityPolicy')) {
134
			$policy = new \OCP\AppFramework\Http\ContentSecurityPolicy();
135
			$policy->allowEvalScript(false);
136
			$policy->disallowScriptDomain('\'self\'');
137
			$policy->disallowConnectDomain('\'self\'');
138
			$policy->disallowFontDomain('\'self\'');
139
			$policy->disallowMediaDomain('\'self\'');
140
			$expectedResponse->setContentSecurityPolicy($policy);
141
		}
142
143
		$actualResponse = $this->controller->getHtmlBody($accountId, base64_encode($folderId), $messageId);
144