mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-15 02:56:55 +01:00
Fix error for commits with SSH signatures
Pushed-by: Rene Pfeuffer<rene.pfeuffer@cloudogu.com> Co-authored-by: René Pfeuffer<rene.pfeuffer@cloudogu.com>
This commit is contained in:
2
gradle/changelog/error_with_ssh_signature.yaml
Normal file
2
gradle/changelog/error_with_ssh_signature.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: fixed
|
||||
description: Internal server error for commits with SSH signatures
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
package sonia.scm.api.v2.resources;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import de.otto.edison.hal.Embedded;
|
||||
import de.otto.edison.hal.Links;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -51,9 +52,11 @@ import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.google.common.base.Strings.emptyToNull;
|
||||
import static de.otto.edison.hal.Embedded.embeddedBuilder;
|
||||
import static de.otto.edison.hal.Link.link;
|
||||
import static de.otto.edison.hal.Links.linkingTo;
|
||||
import static java.util.Optional.ofNullable;
|
||||
|
||||
@Mapper
|
||||
public abstract class DefaultChangesetToChangesetDtoMapper extends HalAppenderMapper implements InstantAttributeMapper, ChangesetToChangesetDtoMapper {
|
||||
@@ -88,7 +91,7 @@ public abstract class DefaultChangesetToChangesetDtoMapper extends HalAppenderMa
|
||||
|
||||
@ObjectFactory
|
||||
SignatureDto createDto(Signature signature) {
|
||||
final Optional<RawGpgKey> key = publicKeyStore.findById(signature.getKeyId());
|
||||
Optional<RawGpgKey> key = ofNullable(emptyToNull(signature.getKeyId())).flatMap(publicKeyStore::findById);
|
||||
if (signature.getType().equals("gpg") && key.isPresent()) {
|
||||
final Links.Builder linkBuilder =
|
||||
linkingTo()
|
||||
|
||||
Reference in New Issue
Block a user