Remove trailing slash on submit
This commit is contained in:
@ -88,7 +88,7 @@ const normalizeOptions = {
|
|||||||
stripWWW: false
|
stripWWW: false
|
||||||
};
|
};
|
||||||
|
|
||||||
function formatUrl(url) {
|
function formatUrl(url, shouldKeepTrailingSlash = true) {
|
||||||
if (
|
if (
|
||||||
typeof url === 'string' &&
|
typeof url === 'string' &&
|
||||||
url.length > 4 &&
|
url.length > 4 &&
|
||||||
@ -96,7 +96,7 @@ function formatUrl(url) {
|
|||||||
) {
|
) {
|
||||||
// prevent trailing / from being stripped during typing
|
// prevent trailing / from being stripped during typing
|
||||||
let lastChar = '';
|
let lastChar = '';
|
||||||
if (url.substring(url.length - 1) === '/') {
|
if (shouldKeepTrailingSlash && url.substring(url.length - 1) === '/') {
|
||||||
lastChar = '/';
|
lastChar = '/';
|
||||||
}
|
}
|
||||||
return normalizeUrl(url, normalizeOptions) + lastChar;
|
return normalizeUrl(url, normalizeOptions) + lastChar;
|
||||||
@ -210,8 +210,8 @@ export default contain({
|
|||||||
locale: inHTMLData(locale.value),
|
locale: inHTMLData(locale.value),
|
||||||
description: inHTMLData(description.value),
|
description: inHTMLData(description.value),
|
||||||
email: inHTMLData(email.value),
|
email: inHTMLData(email.value),
|
||||||
url: uriInSingleQuotedAttr(url.value),
|
url: formatUrl(uriInSingleQuotedAttr(url.value), false),
|
||||||
logo: uriInSingleQuotedAttr(logo.value),
|
logo: formatUrl(uriInSingleQuotedAttr(logo.value), false),
|
||||||
company: inHTMLData(company.value),
|
company: inHTMLData(company.value),
|
||||||
isHighlighted: !!isHighlighted.value,
|
isHighlighted: !!isHighlighted.value,
|
||||||
isFrontEndCert: !!isFrontEndCert.value,
|
isFrontEndCert: !!isFrontEndCert.value,
|
||||||
|
Reference in New Issue
Block a user