From 86e7bf24a3386e19dab89ee376468dd57b6a0e2e Mon Sep 17 00:00:00 2001 From: guqing Date: Thu, 17 Oct 2024 16:30:30 +0800 Subject: [PATCH] fix: prevent initialization failure when theme directory already exists --- .../java/run/halo/app/theme/service/ThemeServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/src/main/java/run/halo/app/theme/service/ThemeServiceImpl.java b/application/src/main/java/run/halo/app/theme/service/ThemeServiceImpl.java index 37a7b142d5..1b6494b708 100644 --- a/application/src/main/java/run/halo/app/theme/service/ThemeServiceImpl.java +++ b/application/src/main/java/run/halo/app/theme/service/ThemeServiceImpl.java @@ -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; @@ -86,6 +87,10 @@ public Mono 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(); }