nextcloud-raw/lib/Controller/ RawResponse.php
16 lines
432 B

  1. <?php
  2. namespace OCA\Raw\Controller;
  3. trait RawResponse {
  4. protected function returnRawResponse($content, $mimetype) {
  5. // Ugly hack to prevent security middleware messing up the CSP.
  6. header(
  7. "Content-Security-Policy: sandbox; default-src 'none'; img-src data:; media-src data:; "
  8. . "style-src data: 'unsafe-inline'; font-src data:; frame-src data:"
  9. );
  10. header("Content-Type: ${mimetype}");
  11. echo $content;
  12. exit;
  13. }
  14. }