Skip to content

Commit c734b42

Browse files
committed
Normalising casing for deep links
1 parent 6cf565a commit c734b42

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/SubProcessorsForm.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,23 +379,23 @@
379379
const smsServicesInputs = form.querySelectorAll('input[name="smsServices"]:checked');
380380

381381
const dataRegion = dataRegionInputs.length > 0 ? dataRegionInputs[0].value : '';
382-
const services = Array.from(servicesInputs).map(input => input.value);
382+
const services = Array.from(servicesInputs).map(input => input.value.toLowerCase());
383383
const emailServices = emailServicesInputs.length > 0 ? emailServicesInputs[0].value : '';
384384
const smsServices = smsServicesInputs.length > 0 ? smsServicesInputs[0].value : '';
385385

386386
const urlParams = new URLSearchParams();
387387

388388
if (dataRegion) {
389-
urlParams.set('data-region', dataRegion.toLowerCase().replace(' ', '-'));
389+
urlParams.set('data-region', dataRegion.toLowerCase().replace(/\s+/g, '-'));
390390
}
391391
if (services.length > 0) {
392392
urlParams.set('services', services.join(','));
393393
}
394394
if (emailServices) {
395-
urlParams.set('email-services', emailServices.toLowerCase().replace(' ', '-'));
395+
urlParams.set('email-services', emailServices.toLowerCase().replace(/\s+/g, '-'));
396396
}
397397
if (smsServices) {
398-
urlParams.set('sms-services', smsServices.toLowerCase().replace(' ', '-'));
398+
urlParams.set('sms-services', smsServices.toLowerCase().replace(/\s+/g, '-'));
399399
}
400400

401401
const newUrl = window.location.pathname + (urlParams.toString() ? '?' + urlParams.toString() : '');
@@ -418,7 +418,7 @@
418418
}
419419

420420
if (services) {
421-
const serviceArray = services.split(',');
421+
const serviceArray = services.toLowerCase().split(',');
422422
serviceArray.forEach(service => {
423423
const serviceValue = service.charAt(0).toUpperCase() + service.slice(1);
424424
const serviceInput = form.querySelector(`input[name="services"][value="${serviceValue}"]`);

0 commit comments

Comments
 (0)