[EP-tech] Trailing Slash Problem
Becker, Pascal-Nicolas
p.becker at tu-berlin.de
Wed Sep 12 17:41:14 BST 2012
Hi,
for the moment I'm testing if EPrints fits our needs. To do so I wanted eprints to run in a subdirectory. After the installation -which was done by my collegue- I run 'epadmin config_core <repository>' and defined a path. I configured the apache and was able to reach the repository under http://example.org/eprints/. But when I opened http://example.org/eprints (without trailing slash!) I got the following error message:
------------------------------------------------------------------
---------------- EPrints System Error ----------------------------
------------------------------------------------------------------
Can't copy /usr/share/eprints3/archives/ubdata/cfg/lang/en/static to /usr/share/eprints3/archives/ubdata/html/en: Is a directory
------------------------------------------------------------------
at /usr/share/eprints3/perl_lib/EPrints/Update/Static.pm line 313
EPrints::Update::Static::copy_plain('/usr/share/eprints3/archives/ubdata/cfg/lang/en/static', '/usr/share/eprints3/archives/ubdata/html/en', 'HASH(0xbae02f50)') called at /usr/share/eprints3/perl_lib/EPrints/Update/Static.pm line 143
EPrints::Update::Static::update_static_file('EPrints::Repository=HASH(0xbab2e080)', 'en', '') called at /usr/share/eprints3/perl_lib/EPrints/Apache/Rewrite.pm line 558
EPrints::Apache::Rewrite::handler('Apache2::RequestRec=SCALAR(0xb8bff3d8)') called at -e line 0
eval {...} called at -e line 0
I'm new to EPrints, so please apologize if I'm doing something wrong. But out of my point of view this is a little bug which can be fixed easily. In .../eprints3/perl_lib/EPrints/Apache/Rewrite.pm in line 497 is a check to look if $uri ends with a trailing slash. If EPrints is located at the root-directory of your URL this slash is added by all browsers. But if EPrints is located in a subdirectory only Firefox adds this slash automatically. But we can check easily if EPrints is located in a subdirectory and the trailing slash is missing. To do so we just have to check, if $uri and $urlpath contains the same strings, assumed that $urlpath never ends with a slash. The following patch does so:
--- perl_lib/EPrints/Apache/Rewrite.pm 2012-09-12 18:23:30.000000000 +0200
+++ /home/pbecker/temp/eprints-3.3.10/perl_lib/EPrints/Apache/Rewrite.pm 2012-05-18 15:21:23.000000000 +0200
@@ -497,8 +497,6 @@
if( $uri =~ m! /$ !x )
{
$localpath.="index.html";
- } elsif ($uri eq $urlpath) {
- $localpath = "/index.html";
}
$r->filename( $repository->get_conf( "htdocs_path" )."/".$lang.$localpath );
Could please someone who knows EPrints better than me have a look on that? Can I assume that $urlpath does not contains a trailing slash?
Thanks for your answers in advanced.
Kind Regards
Pascal Becker
More information about the Eprints-tech
mailing list