diff --git a/app/Security/Presets/MyCspPreset.php b/app/Security/Presets/MyCspPreset.php index 9f442eb..de20ef2 100644 --- a/app/Security/Presets/MyCspPreset.php +++ b/app/Security/Presets/MyCspPreset.php @@ -12,7 +12,7 @@ class MyCspPreset implements Preset { public function configure(Policy $policy): void { - $cdnHost = parse_url((string) env('AWS_CDN_ENDPOINT', ''), PHP_URL_HOST); + $cdnHost = parse_url((string) config('filesystems.disks.s3.cdn_endpoint', ''), PHP_URL_HOST); $scriptSources = array_filter([ Keyword::SELF, diff --git a/app/Support/CloudinaryUrl.php b/app/Support/CloudinaryUrl.php index 8a5ec9b..43f1f62 100644 --- a/app/Support/CloudinaryUrl.php +++ b/app/Support/CloudinaryUrl.php @@ -4,9 +4,9 @@ class CloudinaryUrl { - private const CLOUDINARY_HOST = 'res.cloudinary.com'; + private const string CLOUDINARY_HOST = 'res.cloudinary.com'; - private const UPLOAD_MARKER = '/image/upload/'; + private const string UPLOAD_MARKER = '/image/upload/'; public static function src(string $url, int $width): string { @@ -46,7 +46,7 @@ private static function stripExistingTransforms(string $path): string $segments = explode('/', $path); if ( - isset($segments[0]) + $segments[0] !== '' && preg_match('/^[a-z0-9_,.-]+$/', $segments[0]) && preg_match('/[whcfq]_/', $segments[0]) ) { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index fd4c48e..727218f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -35,8 +35,6 @@ - -