I'm using XAMPP and Drupal in a subdirectory. When enabling the filenode and services module, defining an endpoint and enabling file retrieve, the module relies on $_SERVER['DOCUMENT_ROOT'] for reading the underlying file. In my setup, its value does not contain the subfolder for drupal, so the file path is incorrect and leads to the error message:
fopen(/Applications/XAMPP/xamppfiles/htdocs/sites/default/files/ladung30.pdf) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/drupal/sites/all/modules/services/resources/file_resource.inc on line 265.
The attached patch was already discussed here for drupal itself. It adds a new function to retrieve the path and corrects the "file resource" file.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 1405202-file-getcwd-4.patch | 775 bytes | cotto |
| patch.diff | 2.21 KB | erikwegner |
Comments
Comment #1
marcingy commentedReading the patch and it makes sense but....I would ask the question if this issue should be fixed in core itself. I have no problem looking to commit this as a work around but it just feels kind of wrong to fix it at a module level rather than a core level.
I'll wait for Kylebrowning to weigh in. Marking as needs review to get some eyes.
Comment #3
cotto commentedComment #4
cotto commentedHere's a simpler patch that solves the problem for me.
Comment #5
cotto commentedComment #7
kylebrowning commentedThis looks great.
Comment #8
cotto commentedThis issue should be fixed now. Thanks for reporting.