barryf / micropublish

A Micropub client that you can use to create, update, delete and undelete content on your Micropub-enabled website.
https://micropublish.net
MIT License
68 stars 16 forks source link

Unsupported properties are being deleted on updates #67

Closed jamietanna closed 3 years ago

jamietanna commented 3 years ago

When a post contains properties that Micropublish doesn't support, such as featured, the Micropublish UI doesn't render that property.

I think that's quite reasonable, as there's not necessarily a point showing a property we don't understand.

However, when sending an update request, it appears that Micropublish is deleting the properties it doesn't understand, rather than just ignoring them.

Is that intentional?

Example Post [`https://www.jvt.me/posts/2021/03/24/chef-cookbook-gem-metadata/`](https://www-api.jvt.me/micropub?q=source&url=https://www.jvt.me/posts/2021/03/24/chef-cookbook-gem-metadata/): ```json { "type": [ "h-entry" ], "properties": { "summary": [ "How to source your Chef Gem dependencies from your Chef cookbook's `metadata.rb` instead of duplicating them between files." ], "code-license": [ "Apache-2.0" ], "featured": [ "/img/vendor/chef-logo.png" ], "name": [ "Managing Your Chef Gem Dependencies More Easily in your `Gemfile`" ], "prose-license": [ "CC-BY-NC-SA-4.0" ], "published": [ "2021-03-24T13:42:37+0000" ], "category": [ "blogumentation", "chef", "ruby" ], "post-status": [ "published" ], "content": [ "..." ] } } ```
Update Request Body ```json { "action": "update", "delete": [ "code-license", "featured", "prose-license" ], "replace": { "content": [ "..." ] }, "url": "https://www.jvt.me/posts/2021/03/24/chef-cookbook-gem-metadata/" } ```
barryf commented 3 years ago

That doesn't sound right. There should be a "known properties" list but that may not be working correctly. I'll take a closer look.

barryf commented 3 years ago

@jamietanna I have a PR #68 and a temporary Review App at https://mpubl-pr-68.herokuapp.com with a fix. Can you see if this now works successfully with your server?