Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Access Pages Due to Anchor URL Structure in React Based Plugin #1120

Closed
LiamHillier opened this issue Mar 20, 2024 · 1 comment · Fixed by #1126
Closed

Unable to Access Pages Due to Anchor URL Structure in React Based Plugin #1120

LiamHillier opened this issue Mar 20, 2024 · 1 comment · Fixed by #1126
Assignees
Labels
[Feature] PHP.wasm [Type] Bug An existing feature does not function as intended

Comments

@LiamHillier
Copy link

LiamHillier commented Mar 20, 2024

When users try to reach my plugin page, which employ #/ in the URL structure, they face the error message "Sorry, you are not allowed to access this page." This problem stems from the URL format utilized by the React-based plugin. Subsequent pages such as /squarewoosync#/inventory or /squarewoosync#/settings/general rely on this anchor so we can have direct links to these "pages". It seems that the WordPress playground environment imposes restrictions on accessing pages with URLs containing #/, resulting in the "not allowed to access" error.

Screenshot:
Main plugin page

Plugin Information:
SquareWooSync

Blueprint to reproduce:

{
    "landingPage": "\/wp-admin\/plugins.php",
    "preferredVersions": {
        "php": "8.0",
        "wp": "latest"
    },
    "phpExtensionBundles": [
        "kitchen-sink"
    ],
    "features": {
        "networking": true
    },
    "steps": [
        {
            "step": "installPlugin",
            "pluginZipFile": {
                "resource": "wordpress.org\/plugins",
                "slug": "woocommerce"
            },
            "options": {
                "activate": true
            }
        },
        {
            "step": "installPlugin",
            "pluginZipFile": {
                "resource": "wordpress.org\/plugins",
                "slug": "squarewoosync"
            },
            "options": {
                "activate": true
            }
        },
        {
            "step": "login",
            "username": "admin",
            "password": "password"
        }
    ]
}

Could this be looked into please

@bgrgicak
Copy link
Collaborator

@dd32 did some research and shared this:

FWIW, that’s pointed to a bug in the URL parsing.
Settings
results in:
["REQUEST_URI"]=>
string(81) "/scope:0.0143253986239074/wp-admin/admin.php?page=squarewoosync#/settings/general"
["_REQUEST"]=>
array(1) {
["page"]=>
string(31) "squarewoosync#/settings/general"
}

@bgrgicak bgrgicak added the [Type] Bug An existing feature does not function as intended label Mar 20, 2024
@adamziel adamziel added this to the Zero Crashes milestone Mar 20, 2024
@adamziel adamziel self-assigned this Mar 21, 2024
adamziel added a commit that referenced this issue Mar 21, 2024
Closes #1120

Fixes a bug in the URL parsing where `#foo` is passed to PHP when requesting `/index.php#foo`.

 ## Testing instructions

Confirm the tests passed
brandonpayton pushed a commit that referenced this issue Mar 21, 2024
Closes #1120

Fixes a bug in the URL parsing where `#foo` is passed to PHP when
requesting `/index.php#foo`.

 ## Testing instructions

Confirm the tests passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] PHP.wasm [Type] Bug An existing feature does not function as intended
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants