Skip to content

Commit 48198fc

Browse files
committed
fix url validator to accept localhost
1 parent 837136a commit 48198fc

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

ingest-app/src/cmr/ingest/api/subscriptions.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
[subscription-concept]
8585
(let [method (:Method subscription-concept)
8686
endpoint (:EndPoint subscription-concept)
87-
default-url-validator (UrlValidator.)]
87+
default-url-validator (UrlValidator. UrlValidator/ALLOW_LOCAL_URLS)]
8888

8989
(if (= method "ingest")
9090
(if-not (or (some? (re-matches #"arn:aws:sqs:.*" endpoint)) (.isValid default-url-validator endpoint))

message-queue-lib/src/cmr/message_queue/queue/aws_queue.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
(.build))))
3434

3535
(defn create-queue
36-
"Create an instance of a an AWS queue in either AWS or elasticMQ."
36+
"Create an instance of an AWS queue in either AWS or elasticMQ."
3737
[sqs-client queue-name]
3838
(try
3939
(let [sqs-request (-> (CreateQueueRequest/builder)

metadata-db-app/src/cmr/metadata_db/services/subscriptions.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
(defn- is-valid-subscription-endpoint-url
123123
"Checks if subscription endpoint destination is a valid url. Returns true or false."
124124
[endpoint]
125-
(let [default-validator (UrlValidator.)]
125+
(let [default-validator (UrlValidator. UrlValidator/ALLOW_LOCAL_URLS)]
126126
(.isValid default-validator endpoint)))
127127

128128
(defn- send-sub-to-url-dest

metadata-db-app/test/cmr/metadata_db/test/services/subscriptions_test.clj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,14 @@
711711
(let [fun #'cmr.metadata-db.services.subscriptions/is-valid-subscription-endpoint-url]
712712
(is (= expected (fun endpoint))))
713713

714+
"valid local url -- with http prefix"
715+
true
716+
"http://localhost:9324/000000000000"
717+
718+
"valid local url -- with https prefix"
719+
true
720+
"https://localhost:9324/000000000000"
721+
714722
"valid url -- with https prefix"
715723
true
716724
"https://www.google.com"

0 commit comments

Comments
 (0)