aerni / statamic-advanced-seo

Comprehensive SEO addon for Statamic with flexibility in mind
https://statamic.com/addons/aerni/advanced-seo
11 stars 6 forks source link

Issue with `route:list` when this package is installed #124

Closed daun closed 8 months ago

daun commented 8 months ago

Hi! I've been meaning to give this package a go. During testing, I noticed that the route:list command started throwing an error after installing this package: Undefined array key 2. Looks like the constructor of SeoDefaultsController expects at least three segments from the Request object, which in the route:list command probably doesn't exist. It might also be a misconfiguration on my part...

The change below took care of that in my installation. Not sure if there's any downside to doing this.

class SeoDefaultsController extends CpController
{
    public function __construct(Request $request)
    {
-        $this->type = $request->segments()[2];
+        $this->type = $request->segments()[2] ?? '';
    }
}
aerni commented 8 months ago

Thanks! I just released a new version that fixes the issue.

daun commented 8 months ago

🍊