From 8a722e9ae1338ad0282698ac71fffea3bda4b239 Mon Sep 17 00:00:00 2001 From: Roy Johnson Date: Tue, 30 Jan 2007 20:50:03 +0000 Subject: [PATCH] Image in trash though visible in article --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/File.pm | 9 +++++++++ lib/WebGUI/i18n/English/Asset_File.pm | 12 ++++++++++++ 3 files changed, 22 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 53d696984..f2a2fc38f 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -14,6 +14,7 @@ - fix: A newly released version of Html::Template fixes a bug with global variables and nested loops. testEnvironment.pl has been updated to require that it be used. + - fix: Image in trash though visible in article - fix: Direct 6.8.10-7.2+ Upgrade Problem diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index ee431d21f..3c9664c35 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -401,9 +401,18 @@ sub exportHtml_view { return 'chunked'; } +#-------------------------------------------------------------------- sub www_view { my $self = shift; return $self->session->privilege->noAccess() unless $self->canView; + + # Check to make sure it's not in the trash or some other weird place + my $state = $self->get("state"); + if ($state ne "published" && $state ne "archived") { + my $i18n = WebGUI::International->new($self->session,'Asset_File'); + $self->session->http->setStatus("404"); + return sprintf($i18n->get("file not found"), $self->getUrl()); + } $self->session->http->setRedirect($self->getFileUrl); $self->session->http->setStreamedFile($self->getStorageLocation->getPath($self->get("filename"))); diff --git a/lib/WebGUI/i18n/English/Asset_File.pm b/lib/WebGUI/i18n/English/Asset_File.pm index dece2121d..b6d7c5830 100644 --- a/lib/WebGUI/i18n/English/Asset_File.pm +++ b/lib/WebGUI/i18n/English/Asset_File.pm @@ -146,6 +146,18 @@ our $I18N = { lastUpdated => 1166824158, }, + 'file not found' => { + message => q| + + 404 Not Found + +

Not Found

+ The requested URL %s was not found on this server.

+ + |, + lastUpdated => 0, + }, + }; 1;