I did the same thing in the servlet yesterday and got it work! Thanks for your reply anyway! Its been great working with JSPWiki :)
Janne Jalkanen wrote: > > > The trunk contains a fix for this, though I still think there's > something wrong in your setup, since I have not seen this EVER occur > on 2.6 before. > > http://svn.apache.org/repos/asf/incubator/jspwiki/trunk/src/com/ecyrd/ > jspwiki/attachment/AttachmentManager.java > > and validateFileName() method. > > Then insert the suitable code into AttachmentServlet. You should see > where it is. > > /Janne > > On 5 Jun 2008, at 19:45, Ramya KGrama wrote: > >> I am using 2.6.2 >> After looking through the source code, I may have an idea that >> might work - >> please correct me if you think otherwise - >> Make sure that the fileName that gets written into the attachment's >> properties file is always a relativeName (irrespective of what kind >> of path >> the browser returns). >> To do this, I think in BasicAttachmentProvider.java there is a method >> putPageProperties(). >> I would like to parse the value of att.getFileName() to remove any >> absolute >> paths and make it relative name >> just before it writes to the attachment's properties file: - as below: >> >> /** >> * Writes the page properties back to the file system. >> * Note that it WILL overwrite any previous properties. >> */ >> private void putPageProperties( Attachment att, Properties >> properties ) >> throws IOException, >> ProviderException >> { >> File attDir = findAttachmentDir( att ); >> File propertyFile = new File( attDir, PROPERTY_FILE ); >> >> OutputStream out = new FileOutputStream( propertyFile ); >> >> >> >> String attRelativeName = att.getFileName(); >> int slash = attRelativeName.lastIndexOf("\\"); >> if (slash != -1) >> attRelativeName = attRelativeName.substring(slash + 1); >> >> slash = attRelativeName.lastIndexOf("/"); >> if (slash != -1) >> attRelativeName = attRelativeName.substring(slash + 1); >> >> slash = attRelativeName.lastIndexOf(":"); >> if (slash != -1) >> attRelativeName = attRelativeName.substring(slash + 1); >> properties.store( out, >> " JSPWiki page properties for "+ >> attRelativeName+ >> ". DO NOT MODIFY!" ); >> >> /* properties.store( out, >> " JSPWiki page properties for "+ >> att.getName()+ >> ". DO NOT MODIFY!" ); >> */ >> out.close(); >> } >> Am I going in the right direction? >> I am just hoping this change doesnt have any side effect. >> >> Your immediate help is greatly appreciated! I have spent way too >> much time >> on this already and havent made ANY progress. >> Thanks! >> Ramya >> >> On Wed, Jun 4, 2008 at 3:59 PM, Janne Jalkanen >> <[EMAIL PROTECTED]> >> wrote: >> >>> >>> Setting it to localhost: is in general a bad idea. Use the full >>> name of >>> the machine. >>> >>> As to the full path name being used, that is fixed in the latest >>> SVN trunk. >>> I'm actually a bit surprised that you should see it in 2.6, since >>> it's >>> using a different upload library, the same we've been using for >>> years, and >>> so far nobody has complained about the same thing. It didn't >>> surface until >>> we moved to the Apache fileupload library. >>> >>> Are you sure you are using 2.6.x instead of 2.7? >>> >>> /Janne >>> >>> >>> On Jun 4, 2008, at 22:31 , Ramya KGrama wrote: >>> >>> I do have the baseURL set to http://localhost:8888/JSPWiki >>>> It is the same machine name as localhost. We tried both options. >>>> >>>> On Wed, Jun 4, 2008 at 3:25 PM, Harry Metske >>>> <[EMAIL PROTECTED]> >>>> wrote: >>>> >>>> You have to configure your baseURL to the value you use in your >>>> browser. >>>>> >>>>> The case you're describing you use different values, this gives >>>>> unpredictable results. >>>>> I think in your case you should configure baseURL= >>>>> http://chq006103:8888/JSPWiki< >>>>> http://chq006103:8888/JSPWiki/attach/JSPWiki%20Welcome/C%3A% >>>>> 5Cinnovatorlille93.jpg >>>>> >>>>>> >>>>>> >>>>> regards, >>>>> Harry >>>>> >>>>> 2008/6/4 new2Jaas <[EMAIL PROTECTED]>: >>>>> >>>>> >>>>>> Hello, >>>>>> >>>>>> We are having issues with uploading and downloading attachments >>>>>> using >>>>>> JSPWiki using IE browser. >>>>>> It works perfectly with Netscape/Mozilla/Flock browsers. >>>>>> jspwiki.properties -> we set the following attributes: >>>>>> >>>>>> jspwiki.baseURL = http://localhost:8888/JSPWiki >>>>>> >>>>>> jspwiki.referenceStyle=relative >>>>>> >>>>>> jspwiki.attachmentProvider =BasicAttachmentProvider >>>>>> >>>>>> jspwiki.basicAttachmentProvider.storageDir >>>>>> =C:\\Data\\jspwiki\\NewJSPWiki >>>>>> >>>>>> With the above settings, when using IE browser, it still uses >>>>>> absolute >>>>>> >>>>> path >>>>> >>>>>> when file is uploaded and shows href'd attachment name with >>>>>> target as: >>>>>> >>>>>> >>>>>> http://chq006103:8888/JSPWiki/attach/JSPWiki%20Welcome/C%3A% >>>>> 5Cinnovatorlille93.jpg >>>>> >>>>>> >>>>>> Whereas in Mozill and other browsers - it correctly shows href'd >>>>>> relative >>>>>> url: >>>>>> >>>>>> http://localhost:8888/JSPWiki/attach/JSPWiki%20Welcome/ >>>>> innovatorlille93.jpg >>>>> >>>>>> >>>>>> When we upload a file, it is uploaded under the full name (the >>>>>> full >>>>>> absolute >>>>>> path of the file (from C:\.....<filename>)) - only when we use IE >>>>>> >>>>> browser. >>>>> >>>>>> This does not happen with the other 2 browsers. >>>>>> Thus, we are unable to download the file. >>>>>> >>>>>> Any immediate help is highly appreciated! >>>>>> >>>>>> Thanks! >>>>>> -- >>>>>> View this message in context: >>>>>> >>>>>> http://www.nabble.com/JSPWiki---Attachments---issue-with-IE- >>>>> browser-tp17654151p17654151.html >>>>> >>>>>> Sent from the JspWiki - User mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>>> >>>>> >>>>> -- >>>>> met vriendelijke groet, >>>>> Harry Metske >>>>> Telnr. +31-548-512395 >>>>> Mobile +31-6-51898081 >>>>> >>>>> >>> > > > -- View this message in context: http://www.nabble.com/JSPWiki---Attachments---issue-with-IE-browser-tp17654151p17692058.html Sent from the JspWiki - User mailing list archive at Nabble.com.
