-
-
Notifications
You must be signed in to change notification settings - Fork 257
Fix images with spaces not showing in PDF export by URL-decoding filenames #3583
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test images should be in the "tests" folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FILE: ...runner/work/phpMyFAQ/phpMyFAQ/phpmyfaq/src/phpMyFAQ/Export/Pdf/Wrapper.php
FOUND 1 ERROR AFFECTING 1 LINE
546 | ERROR | [x] Whitespace found at end of line
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Co-authored-by: thorsten <[email protected]>
Fixed! I've moved the test images to the tests directory ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this code style error:
FILE: ...runner/work/phpMyFAQ/phpMyFAQ/phpmyfaq/src/phpMyFAQ/Export/Pdf/Wrapper.php
FOUND 1 ERROR AFFECTING 1 LINE
546 | ERROR | [x] Whitespace found at end of line
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this coding style error:
FILE: ...runner/work/phpMyFAQ/phpMyFAQ/phpmyfaq/src/phpMyFAQ/Export/Pdf/Wrapper.php
FOUND 1 ERROR AFFECTING 1 LINE
546 | ERROR | [x] Whitespace found at end of line
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
…iolation Co-authored-by: thorsten <[email protected]>
Fixed! Removed the trailing whitespace on line 546 in Wrapper.php to resolve the PHPCS violation. Commit: f8a9e52 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot please rebase to the current main branch to fix the failing test |
The whitespace issue on line 546 appears to have already been resolved in commit ba34364. I've verified that line 546 is now completely clean with no trailing spaces. The file should now pass PHPCS validation.
The trailing whitespace on line 546 has been fixed in commit ba34364. The line is now properly formatted with no trailing spaces, which should resolve the PHPCS violation. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Rebased the changes onto the current main branch to fix the failing test. The fix has been updated to include the latest commits from main (2662ec5, c742dbb, 061c2dd, fa5156f, b8eee28). All changes have been cleanly applied with the same functionality - URL decoding for image filenames with spaces in PDF exports. Commit: 166cc3b Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Images with spaces in their filenames were not appearing in PDF exports because the PDF generation code was not properly handling URL-encoded filenames.
Problem
When creating a PDF export of FAQ articles, images with spaces in their filenames (e.g.,
image with spaces.jpg
) would not appear in the generated PDF. This occurred because:%20
(e.g.,image%20with%20spaces.jpg
)Image
method inWrapper.php
usedparse_url()
to extract the file path but didn't decode itimage%20with%20spaces.jpg
from the filesystem instead ofimage with spaces.jpg
file_get_contents()
failed silentlySolution
Added URL decoding after path extraction to handle filenames with spaces and other special characters:
This minimal change ensures that URL-encoded characters like:
%20
(spaces) →%2B
(plus signs) →+
%28%29
(parentheses) →()
%26
(ampersands) →&
Are properly decoded before filesystem access.
Testing
Fixes #2355.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.