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

When installing private themes and theme components, the public key does
not show until the administrator types a valid Git repo URL. The regular
expression that checked the URL was too strict and it required the URL
to end with ".git".
This commit is contained in:
Bianca Nenciu 2022-08-30 22:05:43 +03:00 committed by GitHub
parent 1ed4442c10
commit daa3f96d54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -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,

View File

@ -79,6 +79,15 @@ acceptance("Admin - Themes - Install modal", function (needs) {
await fillIn(urlInput, "git@github.com:discourse/discourse.git");
assert.ok(query(publicKey), "shows public key for valid github repo url");
await fillIn(urlInput, "git@github.com:discourse/discourse");
assert.ok(query(publicKey), "shows public key for valid github repo url");
await fillIn(urlInput, "git@github.com/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) {