forget e164s that don't start with a +

This commit is contained in:
finn 2022-03-02 15:16:25 -08:00
parent fa1f0765d5
commit 8bb40967e5

View file

@ -7,6 +7,7 @@ import (
"log" "log"
"os" "os"
"os/user" "os/user"
"strings"
"time" "time"
"github.com/lib/pq" "github.com/lib/pq"
@ -225,6 +226,13 @@ func moveRecipients(source *sql.DB, dest *sql.DB) error {
if err != nil { if err != nil {
return err return err
} }
if e164.Valid && !strings.HasPrefix(e164.String, "+") {
log.Println("corrupt e164 found, setting to null")
e164.Valid = false
e164.String = ""
}
_, err = dest.Exec("INSERT INTO signald_recipients (rowid, account_uuid, uuid, e164) VALUES ($1, $2, $3, $4)", rowID, accountUUID, recipientUUID, e164) _, err = dest.Exec("INSERT INTO signald_recipients (rowid, account_uuid, uuid, e164) VALUES ($1, $2, $3, $4)", rowID, accountUUID, recipientUUID, e164)
if err != nil { if err != nil {
return err return err