Skip to content

A platform for community discussion. Free, open, simple.

FIX: Allow .git end to miss from Git repo URL (#18092)

Bianca Nenciudaa3f96d5405
diff --git a/app/assets/javascripts/admin/addon/controllers/modals/admin-install-theme.js b/app/assets/javascripts/admin/addon/controllers/modals/admin-install-theme.js
index 02907601804..a168583bd42 100644
--- a/app/assets/javascripts/admin/addon/controllers/modals/admin-install-theme.js
+++ b/app/assets/javascripts/admin/addon/controllers/modals/admin-install-theme.js
@@ -24,7 +24,7 @@ export default Controller.extend(ModalFunctionality, {
keyGenUrl: "/admin/themes/generate_key_pair",
importUrl: "/admin/themes/import",
recordType: "theme",
- checkPrivate: match("uploadUrl", /^ssh\:\/\/.*\@.*\.git$|.*\@.*\:.*\.git$/),
+ checkPrivate: match("uploadUrl", /^ssh:\/\/.+@.+$|.+@.+:.+$/),
localFile: null,
uploadUrl: null,
uploadName: null,
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
index 27eaf158d75..7ecab0566ec 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
@@ -79,6 +79,15 @@ acceptance("Admin - Themes - Install modal", function (needs) {
await fillIn(urlInput, "[email protected]:discourse/discourse.git");
assert.ok(query(publicKey), "shows public key for valid github repo url");
+
+ await fillIn(urlInput, "[email protected]:discourse/discourse");
+ assert.ok(query(publicKey), "shows public key for valid github repo url");
+
+ await fillIn(urlInput, "[email protected]/discourse/discourse");
+ assert.notOk(
+ query(publicKey),
+ "does not shows public key for valid github repo url"
+ );
});
test("modal can be auto-opened with the right query params", async function (assert) {