Skip to content

Commit

Permalink
Merge pull request #18 from arduino/dup-system-update
Browse files Browse the repository at this point in the history
Use submission list from base ref for duplicate URL check
  • Loading branch information
per1234 authored Mar 31, 2021
2 parents 6c26c70 + ba1fb4f commit 43ac7e9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ func populateSubmission(submissionURL string, listPath *paths.Path) (submissionT

// Check if the URL is already in the index.
listLines, err := listPath.ReadFileAsLines()
occurrences := 0
for _, listURL := range listLines {
listURLObject, err := url.Parse(strings.TrimSpace(listURL))
if err != nil {
Expand All @@ -255,11 +254,8 @@ func populateSubmission(submissionURL string, listPath *paths.Path) (submissionT

normalizedListURLObject := normalizeURL(listURLObject)
if normalizedListURLObject.String() == normalizedURLObject.String() {
occurrences++
if occurrences > 1 {
submission.Error = "Submission URL is already in the Library Manager index."
return submission, ""
}
submission.Error = "Submission URL is already in the Library Manager index."
return submission, ""
}
}

Expand Down

0 comments on commit 43ac7e9

Please sign in to comment.