Fix url field focus (#174)

Closes #7140

* Even if the url was blank, it was always appending a `/` at the end
which would cause isBlank to return false. Added logic that if the url
was blank, don’t try to then add the trailing slash.
This commit is contained in:
David Balderston 2016-08-05 23:59:52 -07:00 committed by Kevin Ansfield
parent 8f5d91f0c2
commit 6b7591c2bd

View File

@ -131,12 +131,14 @@ export default TextField.extend(InvokeActionMixin, {
url = url.replace(baseUrlParts.pathname.slice(0, -1), '');
}
if (!url.match(/^\//)) {
url = `/${url}`;
}
if (url !== '') {
if (!url.match(/^\//)) {
url = `/${url}`;
}
if (!url.match(/\/$/) && !url.match(/[\.#\?]/)) {
url = `${url}/`;
if (!url.match(/\/$/) && !url.match(/[\.#\?]/)) {
url = `${url}/`;
}
}
}