nx: strip empty auth header

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-05-16 23:34:04 -07:00
parent df870d5024
commit bf7721cb1f
1 changed files with 11 additions and 0 deletions

View File

@ -26,6 +26,7 @@ namespace OCA\Memories\AppInfo;
use OCA\Memories\ClustersBackend; use OCA\Memories\ClustersBackend;
use OCA\Memories\Listeners\PostDeleteListener; use OCA\Memories\Listeners\PostDeleteListener;
use OCA\Memories\Listeners\PostWriteListener; use OCA\Memories\Listeners\PostWriteListener;
use OCA\Memories\Util;
use OCP\AppFramework\App; use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IBootstrap;
@ -34,6 +35,8 @@ use OCP\Files\Events\Node\NodeDeletedEvent;
use OCP\Files\Events\Node\NodeTouchedEvent; use OCP\Files\Events\Node\NodeTouchedEvent;
use OCP\Files\Events\Node\NodeWrittenEvent; use OCP\Files\Events\Node\NodeWrittenEvent;
const AUTH_HEADER = 'HTTP_AUTHORIZATION';
class Application extends App implements IBootstrap class Application extends App implements IBootstrap
{ {
public const APPNAME = 'memories'; public const APPNAME = 'memories';
@ -80,6 +83,14 @@ class Application extends App implements IBootstrap
ClustersBackend\PlacesBackend::register(); ClustersBackend\PlacesBackend::register();
ClustersBackend\RecognizeBackend::register(); ClustersBackend\RecognizeBackend::register();
ClustersBackend\FaceRecognitionBackend::register(); ClustersBackend\FaceRecognitionBackend::register();
// Extra hooks for native extension calls
if (Util::callerIsNative()) {
// Android webview sends an empty Authorization header which screws up DAV
if (isset($_SERVER[AUTH_HEADER]) && empty($_SERVER[AUTH_HEADER])) {
unset($_SERVER[AUTH_HEADER]);
}
}
} }
public function boot(IBootContext $context): void public function boot(IBootContext $context): void