Skip to content

Commit bbe9570

Browse files
committed
Show resolved URL in duplicate submission error message when relevant
library-registry-submission-parser resolves redirects in the submitted URLs and validates the request for that resolved URL. One of the validations is checking whether the submitted URL is already in the repositories list. If so, the validation fails and the bot makes a comment on the pull request. In the case where the resolved URL is different from the submitted URL, this failure can be confusing, since the duplicate will not be found in a search for the submitted URL. Previously, the comment from the bot only mentioned the submitted URL. The communication about the validation failure under these conditions is hereby improved by using a different error message that explains it is the resolved URL that was found in the list, and states that URL.
1 parent f0f86fc commit bbe9570

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,12 @@ func populateSubmission(submissionURL string, listPath *paths.Path, accessList [
390390

391391
normalizedListURLObject := normalizeURL(listURLObject)
392392
if normalizedListURLObject.String() == normalizedURLObject.String() {
393-
submission.Error = "Submission URL is already in the Library Manager index."
393+
normalizedSubmissionURLObject := normalizeURL(submissionURLObject)
394+
if normalizedURLObject.String() == normalizedSubmissionURLObject.String() {
395+
submission.Error = "Submission URL is already in the Library Manager index."
396+
} else {
397+
submission.Error = fmt.Sprintf("Resolved URL %s is already in the Library Manager index.", normalizedURLObject.String())
398+
}
394399
return submission, "", true
395400
}
396401
}

tests/test_all.py

+21
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,27 @@
253253
"",
254254
"http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/Servo/",
255255
),
256+
(
257+
"resolved-already-in-library-manager",
258+
"FooUser",
259+
"",
260+
"submission",
261+
"",
262+
[
263+
{
264+
"submissionURL": "https://github.com/arduino-org/WiFi_for_UNOWiFi_rev1",
265+
"normalizedURL": "https://github.com/arduino-libraries/WiFi_for_UNOWiFi_rev1.git",
266+
"repositoryName": "WiFi_for_UNOWiFi_rev1",
267+
"name": "",
268+
"official": False,
269+
"tag": "",
270+
"error": "Resolved URL https://github.com/arduino-libraries/WiFi_for_UNOWiFi_rev1.git is already in"
271+
" the Library Manager index.",
272+
}
273+
],
274+
"",
275+
"http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/WiFi_for_UNOWiFi_rev1/",
276+
),
256277
(
257278
"type-arduino",
258279
"FooUser",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
diff --git a/repositories.txt b/repositories.txt
2+
index c080a7a..1194257 100644
3+
--- a/repositories.txt
4+
+++ b/repositories.txt
5+
@@ -1,2 +1,3 @@
6+
+https://github.com/arduino-org/WiFi_for_UNOWiFi_rev1
7+
https://github.com/arduino-libraries/WiFi_for_UNOWiFi_rev1
8+
https://github.com/arduino-libraries/Stepper
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
https://github.com/arduino-libraries/WiFi_for_UNOWiFi_rev1
2+
https://github.com/arduino-libraries/Stepper

0 commit comments

Comments
 (0)