Closed
Description
Issue Type:
Please pick one and delete the rest:
- Bug Report
Bundle Version:
Master
Summary:
We need to encode a path into a Elfinder specific hash. So we tried to use the FM\ElfinderBundle\Loader\ElFinderLoader:: encode($path)
to get the hash for the current path. But the result was always empty.
Steps To Reproduce:
In a properly configured project create a controller like this:
/**
* @Route("/elfinder/path-to-hash/{instance}/{homeFolder}", methods={"GET"})
* @param Request $request
* @param string $instance
* @param string $homeFolder
* @return JsonResponse
*/
public function pathToHash(Request $request, string $instance, string $homeFolder): JsonResponse
$loader = $this->get('fm_elfinder.loader');
$loader->initBridge($instance);
if ($loader instanceof ElFinderLoader) {
$loader->setSession(new ElFinderSession($this->get('session')));
}
$path = $request->query->get('path');
$hash = $loader->encode($path);
return new JsonResponse($hash);
}
Open your browser with the url containing the path in the query string.
Expected Results:
The response should contain the hash for the given path.
Actual Results:
The response always is an empty string.
Possible solution
$aPathEncoded[$hashId] = $volume->getPath($path);
change into:
$aPathEncoded[$hashId] = $volume->getHash($path);
The getPath-method converts a hash into a path. The getHash-method converts a path into a hash!
Metadata
Metadata
Assignees
Labels
No labels