Skip to content

Commit

Permalink
fix: prevent initialization failure when theme directory already exis…
Browse files Browse the repository at this point in the history
…ts (#6889)

#### What type of PR is this?
/kind bug
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
修复从旧版本升级到 2.20 会因为默认主题目录已经存在而无法初始化的问题

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

#### Does this PR introduce a user-facing change?
```release-note
修复从旧版本升级到 2.20 会因为默认主题目录已经存在而无法初始化的问题
```
  • Loading branch information
guqing authored Oct 17, 2024
1 parent 02def4e commit c465bf8
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import run.halo.app.extension.Unstructured;
import run.halo.app.infra.SystemVersionSupplier;
import run.halo.app.infra.ThemeRootGetter;
import run.halo.app.infra.exception.ThemeAlreadyExistsException;
import run.halo.app.infra.exception.ThemeUpgradeException;
import run.halo.app.infra.exception.UnsatisfiedAttributeValueException;
import run.halo.app.infra.properties.HaloProperties;
Expand Down Expand Up @@ -86,6 +87,10 @@ public Mono<Void> installPresetTheme() {
log.warn("Failed to initialize theme from {}", location, e);
return Mono.empty();
})
.onErrorResume(ThemeAlreadyExistsException.class, e -> {
log.warn("Failed to initialize theme from {}, because it already exists", location);
return Mono.empty();
})
.then();
}

Expand Down

0 comments on commit c465bf8

Please sign in to comment.