Fix the problem of updating plugin extensions incorrectly (#5404)

#### What type of PR is this?

/kind bug
/area plugin
/area core
/milestone 2.13.x

#### What this PR does / why we need it:

Fix the problem of updating plugin extensions incorrectly.

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/5394

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/5396/head^2
John Niang 2024-02-26 16:36:11 +08:00 committed by GitHub
parent 348079d82e
commit b132597cac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -38,6 +38,7 @@ public class PluginStartedListener {
.doOnNext(old -> {
unstructured.getMetadata().setVersion(old.getMetadata().getVersion());
})
.map(ignored -> unstructured)
.flatMap(client::update)
.switchIfEmpty(Mono.defer(() -> client.create(unstructured)));
}