Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 7ba336a

Browse files
committed
[#1976] GET /ob/listing/... normalizes legacy listing data
1 parent 29355b4 commit 7ba336a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

api/jsonapi.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,11 @@ func (i *jsonAPIHandler) GETListing(w http.ResponseWriter, r *http.Request) {
14961496
log.Warningf("updating coupons for listing (%s): %s", rsl.GetSlug(), err.Error())
14971497
}
14981498

1499+
if err := rsl.Normalize(); err != nil {
1500+
ErrorResponse(w, http.StatusInternalServerError, fmt.Sprintf("normalizing listing: %s", err.Error()))
1501+
return
1502+
}
1503+
14991504
out, err := rsl.MarshalJSON()
15001505
if err != nil {
15011506
ErrorResponse(w, http.StatusInternalServerError, err.Error())
@@ -1537,7 +1542,14 @@ func (i *jsonAPIHandler) GETListing(w http.ResponseWriter, r *http.Request) {
15371542
}
15381543
sl.Hash = hash
15391544

1540-
out, err := repo.NewSignedListingFromProtobuf(sl).MarshalJSON()
1545+
rsl := repo.NewSignedListingFromProtobuf(sl)
1546+
1547+
if err := rsl.Normalize(); err != nil {
1548+
ErrorResponse(w, http.StatusInternalServerError, fmt.Sprintf("normalizing listing: %s", err.Error()))
1549+
return
1550+
}
1551+
1552+
out, err := rsl.MarshalJSON()
15411553
if err != nil {
15421554
ErrorResponse(w, http.StatusInternalServerError, err.Error())
15431555
return

0 commit comments

Comments
 (0)