Skip to content

Commit

Permalink
Prevent sourceURL greater than length 255 on channel too
Browse files Browse the repository at this point in the history
  • Loading branch information
tiger5226 committed Jul 11, 2020
1 parent 8023552 commit 1b1ced9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion daemon/processing/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,12 @@ func setChannelMetadata(claim *model.Claim, channel pb.Channel) {
claim.SourceSize.SetValid(c.GetSize())
}
if c.GetUrl() != "" {
claim.SourceURL.SetValid(c.GetUrl())
const maxSourceURLLength = 255
sourceURL := c.GetUrl()
if len(sourceURL) > maxSourceURLLength {
sourceURL = sourceURL[:252] + "..."
}
claim.SourceURL.SetValid(sourceURL)
}
if len(c.GetHash()) > 0 {
claim.SourceHash.SetValid(hex.EncodeToString(c.GetHash()))
Expand Down

0 comments on commit 1b1ced9

Please sign in to comment.