• Resolved Nu Ad Agency

    (@nuadagency)


    Hello! WP Custom Admin Interface plugin fails to show the menu to edit in the “Edit Admin Menu” tab. The console logs indicate an issue with malformed URIs during the decoding process.

    Console Error:

    Uncaught URIError: URI malformed
    at decodeURIComponent ()
    at renderAdminMenuManager (options-page-admin-menu.js?ver=7.36:223:54)
    at HTMLDocument. (options-page-admin-menu.js?ver=7.36:242:5)
    at e (load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.5.4:2:27028)
    at t (load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.5.4:2:27330)

    Analysis:

    It seems that the error URIError: URI malformed occurs when decodeURIComponent is called on a string that is not a valid URI. The specific line causing the issue is:

    223:var subLevelMenuThirdValue = decodeURIComponent(subLevelObject[key][3]);

    Upon investigation, it was found that some values being passed to decodeURIComponent are not URIs but plain text or HTML, such as:

    Upgrade For 80% Off! <a target="_blank">Upgrade For 80% Off!</a>

    In this case the issue is caused by additional submenu promo-link from WPMU Defender plugin.

    Proposed quick-fix:

    1. Add helper functions:
    • isValidURI: To check if a string is a valid URI.
    • safeDecodeURIComponent: To safely decode URIs, handling errors gracefully.

    function isValidURI(uri) { return uri.startsWith('https://') || uri.startsWith('https://') || uri.startsWith('ftp://') || uri.startsWith('mailto:'); } function safeDecodeURIComponent(uri) { if (typeof uri !== 'string' || !isValidURI(uri)) { return uri; // Return the original string if it is not a valid URI } try { return decodeURIComponent(uri); } catch (e) { return uri; // Handle the error gracefully } }

    Further analysis and final solution required.

    Regards!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.