Skip to content

Commit

Permalink
fix: solve the problem that tag may be an error when it is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
LIlGG committed Jul 22, 2024
1 parent 0a2f100 commit 2094af6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/run/halo/moments/search/DocumentConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Optional;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.core.convert.converter.Converter;
Expand Down Expand Up @@ -41,7 +42,8 @@ public Mono<HaloDocument> convert(Moment moment) {
haloDoc.setDescription(momentContent.getHtml());
haloDoc.setExposed(isExposed(moment));
haloDoc.setContent(momentContent.getHtml());
haloDoc.setTags(moment.getSpec().getTags().stream().toList());
var tags = moment.getSpec().getTags();
Optional.ofNullable(tags).ifPresent((tag) -> haloDoc.setTags(tag.stream().toList()));
haloDoc.setOwnerName(moment.getSpec().getOwner());
haloDoc.setUpdateTimestamp(moment.getSpec().getReleaseTime());
haloDoc.setCreationTimestamp(moment.getMetadata().getCreationTimestamp());
Expand Down

0 comments on commit 2094af6

Please sign in to comment.