[aur-dev] [PATCH] Display a 404 page if a virtual path doesn't exist

canyonknight at gmail.com canyonknight at gmail.com
Thu Oct 18 12:41:03 EDT 2012


On Thu, Oct 18, 2012 at 3:53 AM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
> Give user feedback instead of bailing out with an empty HTTP response
> body.
>
> Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
> ---
>  web/html/404.php   | 14 ++++++++++++++
>  web/html/index.php |  4 ++++
>  2 files changed, 18 insertions(+)
>  create mode 100644 web/html/404.php
>
> diff --git a/web/html/404.php b/web/html/404.php
> new file mode 100644
> index 0000000..caaaf90
> --- /dev/null
> +++ b/web/html/404.php
> @@ -0,0 +1,14 @@
> +<?php
> +
> +set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
> +
> +html_header( __("Page Not Found") );
> +?>
> +
> +<div id="error-page" class="box 404">
> +       <h2>404 - Page Not Found</h2>
> +       <p>Sorry, the page you've requested does not exist.</p>

Should this be a translated string?

> +</div>
> +
> +<?php
> +html_footer(AUR_VERSION);
> diff --git a/web/html/index.php b/web/html/index.php
> index 6ee23bc..422c0e5 100644
> --- a/web/html/index.php
> +++ b/web/html/index.php
> @@ -102,5 +102,9 @@ if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
>                 header("Content-Type: image/png");
>                 include "./$path";
>                 break;
> +       default:
> +               header("HTTP/1.0 404 Not Found");
> +               include "./404.php";
> +               break;
>         }
>  }
> --
> 1.7.12.3
>


More information about the aur-dev mailing list