Fix for Jira [DS-87] XMLUI file download links break in Google search results if file 'sequence' number changes.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3601 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Tim Donohue
2009-03-17 16:47:37 +00:00
parent 92f0e74c43
commit e8a02edf71
3 changed files with 29 additions and 0 deletions

View File

@@ -243,6 +243,32 @@ public class BitstreamReader extends AbstractReader implements Recyclable
}
}
//if initial search was by sequence number and found nothing,
//then try to find bitstream by name (assuming we have a file name)
if((sequence > -1 && bitstream==null) && name!=null)
{
bitstream = findBitstreamByName(item,name);
//if we found bitstream by name, send a redirect to its new sequence number location
if(bitstream!=null)
{
String redirectURL = "";
//build redirect URL based on whether item has a handle assigned yet
if(item.getHandle()!=null && item.getHandle().length()>0)
redirectURL = request.getContextPath() + "/bitstream/handle/" + item.getHandle();
else
redirectURL = request.getContextPath() + "/bitstream/item/" + item.getID();
redirectURL += "/" + name + "?sequence=" + bitstream.getSequenceID();
HttpServletResponse httpResponse = (HttpServletResponse)
objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
httpResponse.sendRedirect(redirectURL);
return;
}
}
// Was a bitstream found?
if (bitstream == null)
{

View File

@@ -210,6 +210,7 @@
<map:match type="request-parameter" pattern="sequence">
<map:read type="BitstreamReader">
<map:parameter name="handle" value="{../1}/{../2}"/>
<map:parameter name="name" value="{../3}"/>
<map:parameter name="sequence" value="{1}"/>
</map:read>
</map:match>
@@ -230,6 +231,7 @@
<map:match type="request-parameter" pattern="sequence">
<map:read type="BitstreamReader">
<map:parameter name="itemID" value="{../1}"/>
<map:parameter name="name" value="{../2}"/>
<map:parameter name="sequence" value="{1}"/>
</map:read>
</map:match>

View File

@@ -68,6 +68,7 @@
- Fix for SF bug [2543413] XMLUI Submission forms display validation errors on other fields during add/remove
- Fix for SF bug [2557654] Search with "%" causes NullPointerException in XMLUI
- Fix for Jira bug [DS-86] XMLUI Feedback form does not include any protection from spamming
- Fix for Jira [DS-87] XMLUI file download links break in Google search results if file 'sequence' number changes.
(Kim Shepherd)
- [2385187] Fix for toDate method in DCDate