I used a search view with ajax enabled and facets. Had an error in console that source path needs to start with a slash in checkProtectedPage. The getAliasByPath was returning the absolute url. I changed that part of the code and the error was gone.

Comments

DeaOm created an issue. See original summary.

deaom’s picture

Status: Active » Needs review
StatusFileSize
new928 bytes

And the patch.

drup16’s picture

Priority: Minor » Normal
Status: Needs review » Reviewed & tested by the community

This was a roadblock for us to enable View Pages with Ajax enabled while placing Facet Blocks through the /admin/structure/block.

After applying the patch the issue was resolved on all our pages that had facets.

chris matthews’s picture

Version: 8.x-1.1 » 8.x-1.x-dev
oksana-c’s picture

Status: Reviewed & tested by the community » Closed (cannot reproduce)

The issue described by @DeaOm may have originated from a different module, potentially Views or Facets.

I attempted to reproduce this issue with Core 8.8.5, Search API 8.x-1.16, Facets 8.x-1.4 in Ajax enabled search views to no avail.

Also, Core AliasManager which provides getAliasByPath() method has been refactored within the last 5 months, so this may also affect the issue you're experiencing.

If this is still relevant, please provide detailed steps to reproduce, specify used module versions and reopen the issue.

cilefen’s picture

This could be related to #3052574: Facets with AJAX not working in most of situations and in fact what is happening is that with search facets, in ProtectedPagesSubscriber::checkProtectedPage(), $this->currentPath->getPath() can return a full URI, for example, https://example.com/search?search=testing&f[0]=type:event&f[1]=type:scholar. You would normally expect /search to be returned. When the full URI gets passed to AliasManager::getAliasByPath() we get the exception.

As mentioned in #5 this is probably not the fault of this module but rather is getPath() returning wrong data.

It is interesting that the return type comment for getPath is "Returns the path, without leading slashes", but actually does return a leading slash when working normally, which is good, because getAliasByPath obviously requires a leading slash.

cilefen’s picture

Status: Closed (cannot reproduce) » Needs review
StatusFileSize
new889 bytes

By passing the request object to getAliasByPath we can get an accurate result. This will require scrutiny to be sure it doesn't break this access control method.

nickdickinsonwilde’s picture

Status: Needs review » Reviewed & tested by the community

Can confirm this does resolve the issue.

anybody’s picture

Any plans how to proceed here? Any active maintainer for this project?

mrpauldriver’s picture

I am seeing something similar. Could somebody confirm with me if this is the same bug.

The full text of my error message can be found in this pastebin

unsettlingtrend’s picture

I was getting the 500 error and #7 patch worked for me.

mrwhittaker’s picture

StatusFileSize
new820 bytes

Was getting errors trying to apply 3049350-7.patch to protected_pages version 1.7.0 rerolled the patch.

droprocker’s picture

When installing patch in #12, the validation for entered path aliases fails on /admin/config/system/protected_pages/add. Input field for paths only allows /node/123 format.