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

invalid unicode escape sequence #89

Open
ghost opened this issue Oct 2, 2018 · 0 comments
Open

invalid unicode escape sequence #89

ghost opened this issue Oct 2, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 2, 2018

After generating the file and viewing the page I have spotted an error. An error is to do with an invalid Unicode escape sequence. After searching for the bug in the laroute.js file I spotted that JS was trying to scape "\u" in the action part of the route statement.

Whilst I have hardcoded the fix for myself - it might be of benefit to adjust getRouteInformation() method to handle any backslashes within an action.

    /**
     * Get the route information for a given route.
     *
     * @param $route \Illuminate\Routing\Route
     * @param $filter string
     * @param $namespace string
     *
     * @return array
     */
    protected function getRouteInformation(Route $route, $filter, $namespace)
    {
        $host    = $route->domain();
        $methods = $route->methods();
        $uri     = $route->uri();
        $name    = $route->getName();
        $action  = $route->getActionName();
        $laroute = array_get($route->getAction(), 'laroute', null);

        if(!empty($namespace)) {
            $a = $route->getAction();

            if(isset($a['controller'])) {
                $action = str_replace($namespace.'\\', '', $action);
            }
        }
		
	// escape backslashes
        $action = addslashes($action); 
        
        switch ($filter) {
            case 'all':
                if($laroute === false) return null;
                break;
            case 'only':
                if($laroute !== true) return null;
                break;
        }

        return compact('host', 'methods', 'uri', 'name', 'action');
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants