repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

commit
d80260e
parent
f891a2f
author
Eric Bower
date
2025-08-22 12:01:29 -0400 EDT
fix: event data scan exception
2 files changed,  +17, -6
M Makefile
+6, -1
 1@@ -33,7 +33,12 @@ endif
 2 .PHONY: bp-setup
 3 
 4 bp: bp-setup
 5-	$(DOCKER_BUILDX_BUILD) "ghcr.io/picosh/pico/git-pr:$(DOCKER_TAG)" --target release .
 6+	$(DOCKER_BUILDX_BUILD) ghcr.io/picosh/pico/git-pr:$(DOCKER_TAG) --target release .
 7+ifeq ($(DOCKER_CMD),docker)
 8+	# docker
 9+else
10+	podman manifest push ghcr.io/picosh/pico/git-pr:$(DOCKER_TAG)
11+endif
12 .PHONY: bp
13 
14 smol:
M models.go
+11, -5
 1@@ -120,19 +120,25 @@ func (e EventData) String() string {
 2 }
 3 
 4 func (e *EventData) Scan(value any) error {
 5-	if value == nil {
 6+	if value == nil || value == "" {
 7 		return nil
 8 	}
 9-	var bytes []byte
10+
11+	var byt []byte
12 	switch v := value.(type) {
13 	case []byte:
14-		bytes = v
15+		byt = v
16 	case string:
17-		bytes = []byte(v)
18+		byt = []byte(v)
19 	default:
20 		return fmt.Errorf("cannot scan %T into EventData", value)
21 	}
22-	return json.Unmarshal(bytes, e)
23+
24+	if len(byt) == 0 {
25+		return nil
26+	}
27+
28+	return json.Unmarshal(byt, e)
29 }
30 
31 func (e EventData) Value() (driver.Value, error) {