You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem with File Path Format in FileManagerBundle when Integrating with fos_ckeditor in easyadmin 3 #147
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:
Go to the CKEditor instance integrated with FileManager.
Upload an image using FileManager.
Select the image to insert it into CKEditor.
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:
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.
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:
To resolve this, I forked the FileManagerBundle and made modifications to handle the file path more appropriately. Specifically, I added a function to FileTypeService.php that strips out the unwanted /public prefix from the file paths. This function, extractUploadsPath, looks for the /public/uploads part in the file path and removes the /public part to conform to the expected format.
And I've added and replaced a line in the function preview()
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.
Activity
ethsam commentedon Jun 20, 2024
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:
To resolve this, I forked the FileManagerBundle and made modifications to handle the file path more appropriately. Specifically, I added a function to
FileTypeService.phpthat strips out the unwanted/publicprefix from the file paths. This function,extractUploadsPath, looks for the/public/uploadspart in the file path and removes the/publicpart to conform to the expected format.And I've added and replaced a line in the function preview()
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.
ethsam commentedon Dec 17, 2024
https://packagist.org/packages/ethsam/filemanagerbundlefixsymfonyfckeditor