aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-06-23 15:49:51 +0200
committerGitHub <noreply@github.com>2021-06-23 15:49:51 +0200
commit19a84512d688ae899f0f8efc37b89d2a9676cc48 (patch)
treee412824a9805ee2b620867d35e8ee1043914e293 /lib
parenta70fd1bad1626e67982ac59d8b3da486ffad70c5 (diff)
parent65742695d1bd856eb1ce55c1fa5311c4ddcc0a2b (diff)
downloadnextcloud-server-19a84512d688ae899f0f8efc37b89d2a9676cc48.tar.gz
nextcloud-server-19a84512d688ae899f0f8efc37b89d2a9676cc48.zip
Merge pull request #27628 from nextcloud/security-txt
Add security.txt
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/ClassLoader.php4
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/public/AppFramework/Http/TextPlainResponse.php62
4 files changed, 67 insertions, 1 deletions
diff --git a/lib/composer/composer/ClassLoader.php b/lib/composer/composer/ClassLoader.php
index 247294d66ee..6d0c3f2d001 100644
--- a/lib/composer/composer/ClassLoader.php
+++ b/lib/composer/composer/ClassLoader.php
@@ -338,7 +338,7 @@ class ClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
- * @return bool|null True if loaded, null otherwise
+ * @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
@@ -347,6 +347,8 @@ class ClassLoader
return true;
}
+
+ return null;
}
/**
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 6dc516bdb29..55d02c2feeb 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -64,6 +64,7 @@ return array(
'OCP\\AppFramework\\Http\\Template\\LinkMenuAction' => $baseDir . '/lib/public/AppFramework/Http/Template/LinkMenuAction.php',
'OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse' => $baseDir . '/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php',
'OCP\\AppFramework\\Http\\Template\\SimpleMenuAction' => $baseDir . '/lib/public/AppFramework/Http/Template/SimpleMenuAction.php',
+ 'OCP\\AppFramework\\Http\\TextPlainResponse' => $baseDir . '/lib/public/AppFramework/Http/TextPlainResponse.php',
'OCP\\AppFramework\\Http\\TooManyRequestsResponse' => $baseDir . '/lib/public/AppFramework/Http/TooManyRequestsResponse.php',
'OCP\\AppFramework\\Http\\ZipResponse' => $baseDir . '/lib/public/AppFramework/Http/ZipResponse.php',
'OCP\\AppFramework\\IAppContainer' => $baseDir . '/lib/public/AppFramework/IAppContainer.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 61935bd9db8..6f2bb064fc0 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -93,6 +93,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\AppFramework\\Http\\Template\\LinkMenuAction' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Template/LinkMenuAction.php',
'OCP\\AppFramework\\Http\\Template\\PublicTemplateResponse' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php',
'OCP\\AppFramework\\Http\\Template\\SimpleMenuAction' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/Template/SimpleMenuAction.php',
+ 'OCP\\AppFramework\\Http\\TextPlainResponse' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/TextPlainResponse.php',
'OCP\\AppFramework\\Http\\TooManyRequestsResponse' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/TooManyRequestsResponse.php',
'OCP\\AppFramework\\Http\\ZipResponse' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Http/ZipResponse.php',
'OCP\\AppFramework\\IAppContainer' => __DIR__ . '/../../..' . '/lib/public/AppFramework/IAppContainer.php',
diff --git a/lib/public/AppFramework/Http/TextPlainResponse.php b/lib/public/AppFramework/Http/TextPlainResponse.php
new file mode 100644
index 00000000000..93edf704863
--- /dev/null
+++ b/lib/public/AppFramework/Http/TextPlainResponse.php
@@ -0,0 +1,62 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2021 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @author 2021 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCP\AppFramework\Http;
+
+use OCP\AppFramework\Http;
+
+/**
+ * A renderer for text responses
+ * @since 22.0.0
+ */
+class TextPlainResponse extends Response {
+ /** @var string */
+ private $text = '';
+
+ /**
+ * constructor of TextPlainResponse
+ * @param string $text The text body
+ * @param int $statusCode the Http status code, defaults to 200
+ * @since 22.0.0
+ */
+ public function __construct(string $text = '', int $statusCode = Http::STATUS_OK) {
+ parent::__construct();
+
+ $this->text = $text;
+ $this->setStatus($statusCode);
+ $this->addHeader('Content-Type', 'text/plain');
+ }
+
+
+ /**
+ * Returns the text
+ * @return string
+ * @since 22.0.0
+ * @throws \Exception If data could not get encoded
+ */
+ public function render() : string {
+ return $this->text;
+ }
+}