Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit bc77ce6

Browse files
committed
enforcing better URL formatting for Site URL setting.
1 parent b3aa6d0 commit bc77ce6

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

History.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Just a couple minor bug fixes.
88
* Generate public user properties list from schema.
99
* Fixed video lightbox issue.
1010
* Updated Getting Started content.
11+
* Enforcing better URL formatting for Site URL setting.
1112

1213
## v0.20.4 “RefactorScope”
1314

packages/telescope-core/lib/client/templates/forms/urlCustomType.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@ AutoForm.addInputType("bootstrap-url", {
22
template: "afBootstrapUrl",
33
valueOut: function () {
44
var url = this.val();
5-
if(!!url)
6-
return (url.substring(0, 7) === "http://" || url.substring(0, 8) === "https://") ? url : "http://"+url;
5+
if (!!url) {
6+
// add http:// if missing
7+
if (url.substring(0, 7) !== "http://" && url.substring(0, 8) !== "https://") {
8+
url = "http://"+url;
9+
}
10+
// add trailing / if missing (unless URL contains a "?")
11+
if (url.slice(-1) !== "/" && url.indexOf("?") === -1) {
12+
url = url + "/";
13+
}
14+
return url;
15+
}
716
}
817
});
918

packages/telescope-releases/releases/0.20.5.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Just a couple minor bug fixes.
77
* Improve profile completion screen validation & errors.
88
* Generate public user properties list from schema.
99
* Fixed video lightbox issue.
10-
* Updated Getting Started content.
10+
* Updated Getting Started content.
11+
* Enforcing better URL formatting for Site URL setting.

packages/telescope-settings/lib/settings.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ Settings.schema = new SimpleSchema({
1515
siteUrl: {
1616
type: String,
1717
optional: true,
18-
regEx: SimpleSchema.RegEx.Url,
18+
// regEx: SimpleSchema.RegEx.Url,
1919
autoform: {
2020
group: "01_general",
21+
type: "bootstrap-url",
2122
instructions: 'Your site\'s URL (with trailing "/"). Will default to Meteor.absoluteUrl()'
2223
}
2324
},

0 commit comments

Comments
 (0)