thread-master/backend/internal/library/placement/resolve_reply_target.go

18 lines
386 B
Go
Raw Normal View History

2026-07-01 08:42:51 +00:00
package placement
import "strings"
func ResolveReplyTargetID(externalID, permalink string) string {
if id := strings.TrimSpace(externalID); id != "" {
return id
}
permalink = normalizeThreadsPermalink(permalink)
if permalink == "" {
return ""
}
match := threadsPostURLRe.FindStringSubmatch(permalink)
if len(match) < 3 {
return ""
}
return strings.TrimSpace(match[2])
}