R
R
Romantik19912015-12-02 15:49:34
Laravel
Romantik1991, 2015-12-02 15:49:34

How to solve route problem in SleepingOwl Laravel admin?

Hello.
SleepingOwl admin problem.
When you click on the button of the ckeditor editor "Download image from the server" accesses the controller \vendor\sleeping-owl\admin\src\SleepingOwl\Admin\Controllers\[email protected] and all images are loaded there and parameter slashes are encoded when getting the path through route() in the \Illuminate\Routing\[email protected]() class.
a7d38bf4-9901-11e5-9116-98e2c3b8cc89.png
\vendor\sleeping-owl\admin\src\SleepingOwl\Admin\Controllers\[email protected]

...	
  function __construct(Finder $finder, Filesystem $filesystem)
  {
    $this->finder = $finder;
    $this->filesystem = $filesystem;
  }

  /**
   * Get all images within "images" directory without "seeds" subdirectories
   *
   * @return array
   */
  public function getAll()
  {
    $files = $this->getAllFiles();
    $result = [];
    foreach ($files as $file)
    {
      $result[] = $this->createImageObject($file);
    }
    return $result;
  }

  /**
   * @return Finder
   */
  protected function getAllFiles()
  {
    return $this->finder->create()->exclude('seeds')->files()->in(Config::get('admin.imagesDirectory'));
  }

  /**
   * @param SplFileInfo $file
   * @return StdClass
   */
  protected function createImageObject(SplFileInfo $file)
  {
    $obj = new StdClass;
    $path = $file->getRelativePathname();
    $obj->url = <b>route</b>('imagecache', [
      'original',
      $path
    ]);
    $obj->thumbnail = route('imagecache', [
      'small',
      $path
    ]);
    return $obj;
  }
..

\Illuminate\Routing\UrlGenerator
...
protected function toRoute($route, $parameters, $absolute)
{
$parameters = $this->formatParameters($parameters);

    $domain = $this->getRouteDomain($route, $parameters);

    $uri = strtr(<b>rawurlencode</b>($this->addQueryString($this->trimUrl(
        $root = $this->replaceRoot($route, $domain, $parameters),
        $this->replaceRouteParameters($route->uri(), $parameters)
    ), $parameters)), $this->dontEncode);

    return $absolute ? $uri : '/'.ltrim(str_replace($root, '', $uri), '/');
}

rawurlencode() and encode.
This standard class \Illuminate\Routing\UrlGenerator and how to get around all this nicely is not clear.
Laravel 5.1.
Help me please.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2015-12-02
@Romantik1991

%5C is a backslash.
Lead them to "/"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question