Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in upadte backend dialog #487

Merged
merged 6 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Controller/Adminhtml/FastlyCdn/Backend/ConfigureBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public function execute()
$name = $this->getRequest()->getParam('name');
$this->validateName($name);

$maxTls = $this->processRequest('max_tls_version');
$minTls = $this->processRequest('min_tls_version');
$maxTls = $this->getRequest()->getParam('max_tls_version');
$minTls = $this->getRequest()->getParam('min_tls_version');
$this->validateVersion((float)$maxTls, (float)$minTls);

$activate_flag = $this->getRequest()->getParam('activate_flag') === 'true' ? true : false;
Expand All @@ -126,7 +126,7 @@ public function execute()
}

$sslVerifyCert = $this->getRequest()->getParam('ssl_check_cert') === '1' ? true : false;
$sslCertHostname = $this->processRequest('ssl_cert_hostname');
$sslCertHostname = $this->getRequest()->getParam('ssl_cert_hostname');

if ($useSsl && $sslVerifyCert && !$sslCertHostname) {
return $result->setData([
Expand All @@ -135,8 +135,8 @@ public function execute()
]);
}

$sslSniHostname = $this->processRequest('ssl_sni_hostname');
$sslCaCert = $this->processRequest('ssl_ca_cert');
$sslSniHostname = $this->getRequest()->getParam('ssl_sni_hostname');
$sslCaCert = $this->getRequest()->getParam('ssl_ca_cert');

$conditionName = $this->getRequest()->getParam('condition_name');
$applyIf = $this->getRequest()->getParam('apply_if');
Expand Down Expand Up @@ -167,9 +167,9 @@ public function execute()
'ssl_ca_cert' => $sslCaCert,
'ssl_check_cert' => $sslVerifyCert,
'ssl_cert_hostname' => $sslCertHostname,
'ssl_ciphers' => $this->processRequest('ssl_ciphers'),
'ssl_client_cert' => $this->processRequest('ssl_client_cert'),
'ssl_client_key' => $this->processRequest('ssl_client_key'),
'ssl_ciphers' => $this->getRequest()->getParam('ssl_ciphers'),
'ssl_client_cert' => $this->getRequest()->getParam('ssl_client_cert'),
'ssl_client_key' => $this->getRequest()->getParam('ssl_client_key'),
'ssl_sni_hostname' => $sslSniHostname,
'max_tls_version' => $maxTls,
'min_tls_version' => $minTls,
Expand Down
6 changes: 1 addition & 5 deletions Controller/Adminhtml/FastlyCdn/Backend/ValidationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ private function validateAddress($address)
*/
private function validateOverride($override)
{
if ($override === '') {
return null;
}

if (!filter_var($override, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
if ($override !== '' && !filter_var($override, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
throw new LocalizedException(__('Override host ' . $override . ' is not a valid hostname.'));
}

Expand Down
6 changes: 3 additions & 3 deletions Controller/Adminhtml/FastlyCdn/Domains/PushDomains.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ private function processNew($newDomains)
$newName = $new['name'];
$newComment = $new['comment'];
$newDomainData[$newName] = $newComment;
if (!preg_match('/^(?:\*\.)?(?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,}$/', $newName)) {
throw new LocalizedException(__('Invalid domain name "'.$newName.'"'));
} elseif (strlen($newName) > 253) {
if (strlen($newName) > 253) {
throw new LocalizedException(__('Domain name too long (must be 253 characters or less) "'.$newName.'"'));
} elseif (!filter_var($newName, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
throw new LocalizedException(__('Invalid domain name "'.$newName.'"'));
}
}
return $newDomainData;
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/FastlyCdn/Vcl/Comparison.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function execute()
'status' => false,
'local' => $localVersion,
'header' => $headerVersion,
'msg' => 'Plugin VCL is outdated or VCL was not uploaded! Please click Upload above to correct.'
'msg' => 'Plugin VCL is outdated or VCL was not uploaded. Please click Upload above to correct. You can ignore this warning message if you have not yet routed your store domains to Fastly due to testing, etc.'
]
);
}
Expand Down
Loading