-
Notifications
You must be signed in to change notification settings - Fork 89
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
Problem with File Path Format in FileManagerBundle when Integrating with fos_ckeditor in easyadmin 3 #147
Comments
Hi, I wanted to provide an update regarding the issue with the file path format when integrating FileManagerBundle with fos_ckeditor in EasyAdmin 3. I encountered a problem where the file path returned after uploading an image included unnecessary query parameters and was not formatted as needed for clean usage within CKEditor and Easyadmin. Solution Implemented: And I've added and replaced a line in the function preview() $filePathReal = $this->extractUploadsPath($file->getPathname());
// return $this->fileIcon($filePath, $extension, $size, true, $fileManager->getConfigurationParameter('twig_extension'), $fileManager->getConfigurationParameter('cachebreaker'));
return $this->fileIcon($filePathReal, $extension, $size, true, $fileManager->getConfigurationParameter('twig_extension'), $fileManager->getConfigurationParameter('cachebreaker')); function extractUploadsPath($fullPath) {
$partToFind = '/public/uploads';
$result = strstr($fullPath, $partToFind);
if ($result !== false) {
return str_replace('/public', '', $result);
}
return '';
} Due to time constraints and the immediate needs of our ongoing project, I opted to implement a direct modification rather than exploring a more comprehensive solution that might involve deeper changes to the FileManagerBundle's core functionalities or its integration strategy with CKEditor. This solution allows us to move forward with our project deadlines while still maintaining a clean and functional integration with CKEditor. It would be great to explore a more generic solution that could be incorporated into the FileManagerBundle in the future to avoid such issues. I hope that the modifications I've implemented might provide a useful reference for addressing this file path issue in future versions of the FileManagerBundle. It would be beneficial for the community if a more generic solution could be integrated into the bundle to prevent similar issues when using FileManager with CKEditor or other editors. Incorporating a way to configure the path formatting directly through the FileManagerBundle's settings could offer a more flexible and robust integration, making it easier for users to adapt the bundle to their specific needs without requiring custom forks or modifications. Thank you again for considering this feedback. I am looking forward to seeing how this can be evolved to enhance the FileManagerBundle for all users. |
Issue Description
I am encountering an issue with FileManagerBundle where the file path returned after uploading an image includes unnecessary query parameters and formatting that complicates its use within CKEditor. The path returned is as follows:
/manager/file/mypicture.jpeg?conf=images&module=ckeditor&CKEditor=Item_content&CKEditorFuncNum=3&langCode=fr
Steps to Reproduce
Expected Behavior
The expected behavior is that the file path should be clean and usable directly within CKEditor, ideally formatted as:
/uploads/images/mypicture.jpeg
Actual Behavior
The actual file path returned includes query parameters and URL encoding that are not necessary for the use within CKEditor, making it less clean and potentially problematic for routing:
/manager/file/mypicture.jpeg?conf=images&module=ckeditor&CKEditor=Item_content&CKEditorFuncNum=3&langCode=fr
Suggested Fix or Enhancement
A potential fix would be to adjust the FileManagerBundle's integration with CKEditor to strip unnecessary URL parameters and possibly provide a cleaner, more direct path format. This might involve configuring how FileManager handles file path returns or modifying how CKEditor receives and processes these paths.
Additional Information
This issue impacts usability and could affect other integrations where clean paths are necessary. A solution would help ensure FileManagerBundle works seamlessly with CKEditor and other similar applications.
Thank you for looking into this matter. I am looking forward to your suggestions or fixes.
The text was updated successfully, but these errors were encountered: