From 50701b3dde69c4088bd4c12e33a2f67cdb2dbe8d Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Fri, 30 Oct 2015 14:43:38 -0700 Subject: [PATCH] Remove trailing slash on submit --- common/app/routes/Jobs/components/NewJob.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/app/routes/Jobs/components/NewJob.jsx b/common/app/routes/Jobs/components/NewJob.jsx index cd5cbb237a..fea39cf6d6 100644 --- a/common/app/routes/Jobs/components/NewJob.jsx +++ b/common/app/routes/Jobs/components/NewJob.jsx @@ -88,7 +88,7 @@ const normalizeOptions = { stripWWW: false }; -function formatUrl(url) { +function formatUrl(url, shouldKeepTrailingSlash = true) { if ( typeof url === 'string' && url.length > 4 && @@ -96,7 +96,7 @@ function formatUrl(url) { ) { // prevent trailing / from being stripped during typing let lastChar = ''; - if (url.substring(url.length - 1) === '/') { + if (shouldKeepTrailingSlash && url.substring(url.length - 1) === '/') { lastChar = '/'; } return normalizeUrl(url, normalizeOptions) + lastChar; @@ -210,8 +210,8 @@ export default contain({ locale: inHTMLData(locale.value), description: inHTMLData(description.value), email: inHTMLData(email.value), - url: uriInSingleQuotedAttr(url.value), - logo: uriInSingleQuotedAttr(logo.value), + url: formatUrl(uriInSingleQuotedAttr(url.value), false), + logo: formatUrl(uriInSingleQuotedAttr(logo.value), false), company: inHTMLData(company.value), isHighlighted: !!isHighlighted.value, isFrontEndCert: !!isFrontEndCert.value,