Skip to content

Commit

Permalink
nx: strip empty auth header
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <radialapps@gmail.com>
  • Loading branch information
pulsejet committed May 17, 2023
1 parent df870d5 commit bf7721c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use OCA\Memories\ClustersBackend;
use OCA\Memories\Listeners\PostDeleteListener;
use OCA\Memories\Listeners\PostWriteListener;
use OCA\Memories\Util;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand All @@ -34,6 +35,8 @@
use OCP\Files\Events\Node\NodeTouchedEvent;
use OCP\Files\Events\Node\NodeWrittenEvent;

const AUTH_HEADER = 'HTTP_AUTHORIZATION';

class Application extends App implements IBootstrap
{
public const APPNAME = 'memories';
Expand Down Expand Up @@ -80,6 +83,14 @@ public function register(IRegistrationContext $context): void
ClustersBackend\PlacesBackend::register();
ClustersBackend\RecognizeBackend::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
Expand Down

0 comments on commit bf7721c

Please sign in to comment.