1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-22 13:42:48 +02:00

Be clearer about missing params

Fixes #423
This commit is contained in:
Steve Clay
2015-09-29 15:59:02 -04:00
parent 5793db9098
commit 53a832fd90
2 changed files with 13 additions and 6 deletions

View File

@@ -107,9 +107,10 @@ $minify = call_user_func($min_factories['minify'], $cache);
if (!$env->get('f') && $env->get('g') === null) {
// no spec given
$msg = '<p>No "f" or "g" parameters were detected.</p>';
$url = 'https://github.com/mrclay/minify/blob/master/docs/CommonProblems.wiki.md#long-url-parameters-are-ignored';
$defaults = $minify->getDefaultOptions();
$url = 'https://github.com/mrclay/minify/blob/master/docs/UserGuide.wiki.md#creating-minify-urls';
$minify->errorExit($defaults['badRequestHeader'], $url);
$minify->errorExit($defaults['badRequestHeader'], $url, $msg);
}
$sourceFactoryOptions = array();

View File

@@ -428,14 +428,15 @@ class Minify {
/**
* Show an error page
*
* @param string $header E.g. 'HTTP/1.0 500 Internal Server Error'
* @param string $url URL to direct the user to
* @param string $header Full header. E.g. 'HTTP/1.0 500 Internal Server Error'
* @param string $url URL to direct the user to
* @param string $msgHtml HTML message for the client
*
* @return void
* @internal This is not part of the public API and is subject to change
* @access private
*/
public function errorExit($header, $url)
public function errorExit($header, $url = '', $msgHtml = '')
{
$url = htmlspecialchars($url, ENT_QUOTES);
list(,$h1) = explode(' ', $header, 2);
@@ -445,7 +446,12 @@ class Minify {
header($header, true, $code);
header('Content-Type: text/html; charset=utf-8');
echo "<h1>$h1</h1>";
echo "<p>Please see <a href='$url'>$url</a>.</p>";
if ($msgHtml) {
echo $msgHtml;
}
if ($url) {
echo "<p>Please see <a href='$url'>$url</a>.</p>";
}
exit;
}