Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Bug Report and Proposed Solution: Syntax Error with Special Characters in URL Handling

    Bug Report
    2
    2
    79
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      yass_as last edited by

      I hope you're doing well. I would like to report a bug related to URL handling in Bagisto and propose a potential solution that I've implemented.

      When a URL or search query contains special characters, specifically an apostrophe ('), it triggers a syntax error in the Vue component, causing the following error message:

      Uncaught SyntaxError: missing ) after argument list
      To reproduce the issue, navigate to the search page and enter a query containing an apostrophe, such as Men's Shoes. The following error appears in the console:

      Uncaught SyntaxError: missing ) after argument list

      The expected behavior is for the search page to handle special characters, including apostrophes, correctly without breaking the page. However, the current behavior causes a syntax error, preventing the product listing from displaying properly.

      To fix this, I implemented the following solution in the Blade template to escape the title using the addslashes function. This ensures that special characters are handled correctly in the search query:

      <h1 class="text-2xl font-medium max-sm:text-base" v-text="{{ addslashes($title) }}" style="margin-top: 5%;"></h1>
      This change can be made in the file located at packages/Webkul/Shop/src/Resources/views/search/index.blade.php.

      After making this adjustment, the page now correctly handles search queries with special characters without throwing errors, and products are displayed as expected.

      ashish2409 1 Reply Last reply Reply Quote 0
      • ashish2409
        ashish2409 @yass_as last edited by

        @yass_as

        Thank you for your concern and query. I am pleased to inform you that the issue has already been raised and is currently being addressed.
        For your reference, you can track the progress here: https://github.com/bagisto/bagisto/issues/10217

        1 Reply Last reply Reply Quote 0
        • First post
          Last post