vaakash / git-it-write

A WordPress plugin to publish markdown files present in a Github repository as posts to WordPress automatically.
https://www.aakashweb.com/wordpress-plugins/git-it-write/
GNU General Public License v3.0
45 stars 22 forks source link

Locate the WP Contents/Uploads directory. #18

Closed mnott closed 1 year ago

mnott commented 1 year ago

For some reason, my images would not show up on my WP installation.

This little fix hard-codes (sort of) the path to uploads.

There should be a better way of doing this.

Signed-off-by: Matthias Nott matthias.nott@sap.com

lukaszpiotrluczak commented 1 year ago

I think this is too much fix for your needs.

Can you provide some information how to reproduce the issue? I will take a look and find a better way to handle this.

mnott commented 1 year ago

Thanks Lukasz. I've updated the plugin right now and tried a dummy post. Just got a 500 and don't really see the error. Anyway, here's the diff between what works and what does not ("laeuftnicht" => does not work):

https://pastebin.com/zrSZX8mV

vaakash commented 1 year ago

Hi @mnott, GIW uses media_sideload_image function to upload the image. Hence the upload directory is just a black box for the plugin. WordPress will upload the image as per the media configuration and return the attachment ID and the uploaded HTTP URL.

Regarding the 500 error, it is expected sometimes because the webhook might time out when there are many posts to upload. But you can be certain that all the changes in the commit will be published,