Skip to content

Commit

Permalink
Check if post id is correct, starts with 'C'
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Jul 7, 2024
1 parent 015447a commit 277dc44
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions handlers/scraper/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ type InstaData struct {
}

func GetData(postID string) (*InstaData, error) {
if postID[0] != 'C' {
return nil, errors.New("postID is not a valid Instagram post ID")
}

cacheInstaData, closer, err := DB.Get(utils.S2B(postID))
if err != nil && err != pebble.ErrNotFound {
log.Error().Str("postID", postID).Err(err).Msg("Failed to get data from cache")
Expand Down

0 comments on commit 277dc44

Please sign in to comment.