Closed mlabrum closed 9 months ago
@mlabrum Do you know whether there's a way to make it actually work with the local API instead of just ignoring local API calls? I'm not too familiar with the local API in general.
In any case, thank you for bringing this issue up, I'll do my own research once I get a chance, but I'll merge this for now so that local API calls at least don't fail. It would be nice if the plugin worked with the local API as well though.
Also, thanks for the build-related changes as well, they look sound at first glance. I originally made the build script shell out to ncc, as I didn't want to bother figuring the API out, but it's definitely better this way :D
Released in 2.0.1.
Hey @invakid404, this change does make it work with the local API.
I found req.collection doesnt seem to be set with the local API so that part of the hook check failed, so I changed it to only require req.collection if it is not the local api.
Maybe we don't need that if check anymore? (It doesnt seem like req.collection is used?) This change made it generate blurhashes with the above local api code.
Honestly the NCC repo readme provided most of the code, I just made it write to disk.
Thanks for the quick response!
@mlabrum oh! I only looked at the changes in isolation and didn't understand what the issue was. Now that I looked at it more carefully, yes, you are right, req.collection
is not used anywhere anymore. It was previously necessary, as I used req.collection
to derive the path to the media folder, but since the files are retrieved from the request now, the check can be dropped altogether.
I did that in this commit and released it as v2.0.2. Let me know if it still works, as I can't test it properly right now.
Hello!
Thanks for creating this library.
I've been trying to upload media from the payload local API, and I've found the payload local API doesn't always set
req.collection
which means this plugin bails out due toreq.collection
not existing.e.g
I've also updated the build script to use the NCC node api, as the build script would not run for me locally and removed the requirement to use yarn to run the build script.
Thanks!