Skip to content

Commit a60ed60

Browse files
committed
fix to allow https:// origins
1 parent 87ece6b commit a60ed60

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/WAC.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ private function isOriginGranted($requestedGrants, $uri, $origin, $allowedOrigin
125125
return true;
126126
}
127127
$parsedOrigin = parse_url($origin)['host'];
128-
if (in_array($parsedOrigin, $allowedOrigins)) {
128+
if (
129+
in_array($parsedOrigin, $allowedOrigins, true) ||
130+
in_array($origin, $allowedOrigins, true)
131+
) {
129132
return true;
130133
}
131134
//error_log("REQUESTED GRANT: " . join(" or ", $requestedGrants) . " on $uri");
@@ -480,9 +483,16 @@ private function getParentUri($uri) {
480483
if ($path == "/") {
481484
return $uri;
482485
}
483-
486+
if ($path == $this->basePath) {
487+
return $uri;
488+
}
489+
484490
$parentPath = dirname($path) . '/';
485-
if ($this->filesystem->has(str_replace($this->basePath, '', $parentPath))) {
491+
492+
$localPath = str_replace($this->basePath, '', $parentPath);
493+
if ($localPath == "/") {
494+
return $uri->withPath($parentPath);
495+
} elseif ($this->filesystem->has($localPath)) {
486496
return $uri->withPath($parentPath);
487497
} else {
488498
return $this->getParentUri($uri->withPath($parentPath));

0 commit comments

Comments
 (0)