[jcifs] Creating file with hash ('#') in filename

Michael B. Allen miallen at eskimo.com
Tue Jan 14 18:27:11 EST 2003


On Mon, 13 Jan 2003 12:29:37 -0600
"Christopher R. Hertel" <crh at ubiqx.mn.org> wrote:

> In general (not just in the draft) once the URL is parsed the individual 
> pieces should be URL decoded.  Parse first, decode second.  Then the 
> filename portion (or the pathname, depending on how it gets figured out) 
> would be converted to "test#1.txt".
> 
> I took the fragmentation paragraph out of the latest draft because,
> basically, it doesn't make any sense to use fragmentation in a filesharing
> protocol.  It makes sense for http because it *knows* that it will be
> dealing with hypertext.  Still, a general-purpose parser will see the # as
> a fragment delimiter, so it should be escaped.

I'd rather not decode the path component unless absolutely necessary.

> 
> I assume that there is some point at which the information passes from the 
> Java URL class to the jCIFS code.  This is probably the point at which the 
> escapes could be translated and removed from the strings.

Yes, the jcifs/smb/Handler.java has access to this. It might simply be
a matter of determining that the java.net.URL class identified a #ref
and tack it back on. Boy that would be nice.

> 
> Chris -)-----
> 
> On Mon, Jan 13, 2003 at 12:43:26PM -0500, Michael B. Allen wrote:
> > On Mon, 13 Jan 2003 09:06:49 -0800
> > Thomas Krammer <TKrammer at nxn-software.com> wrote:
> > 
> > > Hi everyone,
> > > 
> > > I'm trying to create a file with a hash mark ('#') in the filename on a SMB
> > > server. This works fine using the Windows Explorer but fails when I try it
> > > using jCIFS 0.7.0.
> > > 
> > > When I'm using the SMB URL "smb://server/share/test#1.txt" a file named
> > > "test" is created because the "#1.txt" is interpreted as the fragment part
> > > of the URL.
> > > 
> > > When I URL encode the hash mark ("smb://server/share/test%231.txt") a file
> > > named "test%231.txt" gets created.
> > > 
> > > Looking at the "SMB Filesharing URL Scheme" document I didn't find any
> > > information how to encode the path component of the SMB URL.
> > > 
> > > Did I miss something or is it simply not possible? 
> > 
> > No. It's currently not possible to reference such a file. I've known
> > about this for a while but I have not quite come up with a solution.
> > 
> > Actually this is your area Chris. What does the latest draft way :~)
> > 
> > -- 
> > A  program should be written to model the concepts of the task it
> > performs rather than the physical world or a process because this
> > maximizes  the  potential  for it to be applied to tasks that are
> > conceptually  similar and, more important, to tasks that have not
> > yet been conceived. 
> 
> -- 
> Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
> jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
> ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
> OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org
> 


-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and, more important, to tasks that have not
yet been conceived. 



More information about the jcifs mailing list