Skip to content

ZAK-266 Fix - Normalize paths before comparison to avoid invalid survey asset URL - #1

Open
iamprazol wants to merge 1 commit into
mainfrom
ZAK-266-sdk-invalid-survey-asset-url
Open

ZAK-266 Fix - Normalize paths before comparison to avoid invalid survey asset URL#1
iamprazol wants to merge 1 commit into
mainfrom
ZAK-266-sdk-invalid-survey-asset-url

Conversation

@iamprazol

Copy link
Copy Markdown

Issue

On Windows, AbstractModule::get_sdk_uri() generates an invalid URL for the survey dependency script (and potentially other assets resolved through this method), producing a 500 error on every load of the Zakra Dashboard:
image

Fix

Normalize both sides with wp_normalize_path() before the strpos() comparison, so the check is reliable regardless of platform-specific path-separator quirks. Also swapped the . '/themegrill-sdk/' suffix trick for . '/load.php' — same effect (both rely on plugins_url()'s internal dirname() dropping the trailing segment to land back at the SDK's own directory), but anchored to a real, known file instead of a string that only worked by coincidence.

Testing

Verified with a standalone script simulating the exact scenario from the bug report (the theme's own SDK copy winning the "max version" race):

Before: strpos() on the raw paths → false → wrongly takes the plugins_url() branch.
After: strpos() on the normalized paths → 0 → correctly takes the get_template_directory_uri() branch.
No effect on non-Windows environments, where paths are already forward-slash-only (normalization is a no-op there).

Fixes ZAK-266.

@iamprazol
iamprazol requested a review from asheshmagar August 5, 2026 10:28
@iamprazol iamprazol self-assigned this Aug 5, 2026
@iamprazol iamprazol added the bug Something isn't working label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant