Skip to content

Commit d1ed898

Browse files
authored
Merge pull request #25 from per1234/duplicate-submissions
Check for duplicates within the submission itself
2 parents 4bbdbc1 + 31ba82a commit d1ed898

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

main.go

+9
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ func main() {
129129
indexerLogsURLs = append(indexerLogsURLs, indexerLogsURL(submission.NormalizedURL))
130130
}
131131

132+
// Check for duplicates within the submission itself.
133+
submissionURLMap := make(map[string]bool)
134+
for submissionIndex, submission := range req.Submissions {
135+
submissionURLMap[submission.NormalizedURL] = true
136+
if len(submissionURLMap) <= submissionIndex {
137+
req.Submissions[submissionIndex].Error = "Submission contains duplicate URLs."
138+
}
139+
}
140+
132141
// Assemble the index entry for the submissions.
133142
req.IndexEntry = strings.Join(indexEntries, "%0A")
134143

0 commit comments

Comments
 (0)