GatherContent has deprecated the use of "url" within https://docs.gathercontent.com/reference#get-item-files - The correct method of downloading the file is to now call https://docs.gathercontent.com/reference#get-filesfile_iddownload which is authenticated, where as before it wasn't so a standard file_get_contents would suffice.
Downloading files
Although the list files endpoint returns a file URL in the response, this should not be used to download the file content, and should be considered deprecated to be removed in the next API version. The correct way to download the file content is to make an authenticated GET request to /files/{file_id}/download. See docs further down https://docs.gathercontent.com/reference#get-filesfile_iddownload
I contacted GatherContent as they hadn't incremented their API version from 0.5 at all so the depreciation seemed out of the blue. I've provided a patch for 7.x-3.3 which is tested and confirmed works, the implementation isn't the nicest and may cause memory issues if dealing with lots of files but a bit of rewrite would of been required otherwise.
Also attached a patch for the latest dev build on 7.x-3.x-dev but this is untested (due to conflicts on guzzlehttp versions within composer manager), can someone please verify.
I've done a brief check into the latest dev alpha build on D8 and believe the same the same issue exists.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | gathercontent-3059496-9-2.patch | 2.96 KB | Kova101 |
| #10 | gathercontent-3059496-7.x-3.3-9.patch | 2.9 KB | Kova101 |
Comments
Comment #2
trothwell commentedComment #3
Kova101 commentedHello trothwell,
Thank you for the patch!
I reviewed it and made another one for the 7.x-3.x branch.
Your solution worked perfectly only one thing was not right.
In your implementation the backend logic would download all the files for an entity which can cause some unused files.
I changed the implementation to download only the required files and left the others out from the pool.
You can find the patch attached. the 7.x-3.3 will come soon, but my advice is that to use the latest version of the module (just for information, the 7.x-3.5 has a security fix, so it is highly recommended to use that version).
And as you mentioned, the 8.x versions had this bug also, but I already fixed that in the 8.x-4.x and 8.x-3.x branches.
I will soon make a release for these.
Comment #5
Kova101 commentedAnd here comes the 3.3 patch!
It contains the same logic, so please trothwell confirm that it works for you as well.
Comment #7
Kova101 commentedOops I left an undefined variable in the code sorry, here are the fixes.
So please ignore my previous patches.
Comment #9
trothwell commentedPerfect, thanks for the prompt reply. Looks good! The upgrade is on the todo list in the coming days.
Thanks again.
Comment #10
Kova101 commentedSorry again..... This is not my day...
I promise these are the last ones.
Comment #11
trothwell commentedMight be a bit too early? :P
https://i.imgur.com/r8OXhw0.png
Comment #12
Kova101 commentedOr too late, depends :D
Comment #13
Csongi95 commentedI checked and tested it.
This issue is fixed and pushed in the new release (7.x-3.6).