[tahoe-dev] help: how should you tell a web browser what name to use for a file?

zooko zooko at zooko.com
Sat May 10 19:04:14 UTC 2008


I wrote:

> Hm...  Maybe that's not the *only* option.  Here's one that I haven't
> previously considered: use "/@@/" to denote the end of the path and
> the beginning of the "name for the web browser to use".

By the way, just to be clear, and as Brian already mentioned, if we  
choose the strategy in which you can give a special-for-the-web- 
browser name only to capabilities that denote files, and not to paths  
leading from a capability that denotes a directory to some child,  
then we don't need any such special syntax -- whenever the first part  
after the "/uri/" (or "/cap/", or "/named/") is a capability to file,  
then the trailing "/name" always means the name the web browser  
should use to save, and whenever the first part is a capability to a  
directory, then the trailing "/name" always means the child of a  
parent directory.

I am increasingly in favor of this option, which is 1.b from ticket  
#221.  It would look like this:

http://tahoebs1.allmydata.com:8123/named/URI%3ACHK% 
3Awaqatup4yk7dyoosuyaux6vwzu% 
3Alzoa4c2phsp3x7ws47bofsbihjm5avxqo35qrqscgqvtwrjotyra%3A3%3A10% 
3A313227/whee.ogg

^-- a file denoted by its capability and which should be called  
"whee.ogg" by your web browser

http://tahoebs1.allmydata.com:8123/cap/URI%3ADIR2% 
3Azp3htohtvqpfjpcjzbt26g7lty% 
3Avd7tcfgpyboqjrl73yld2pcj5yepi3fn3ulhbcqfkyfnzkcugj4q/whee.ogg

^-- a file denoted by being the child called "whee.ogg" by the  
directory whose capability is in the URL

What I don't like about this is that people can easily confuse these  
two, so I hereby offer 1.c, where you can specify a name just for the  
browser to use only when the capability denotes a file, and the top- 
level component is "/named/", and the name for the browser to use is  
separated from the pathname by some special characters, perhaps like  
this:

http://tahoebs1.allmydata.com:8123/named/URI%3ACHK% 
3Awaqatup4yk7dyoosuyaux6vwzu% 
3Alzoa4c2phsp3x7ws47bofsbihjm5avxqo35qrqscgqvtwrjotyra%3A3%3A10% 
3A313227@@name=/whee.ogg

^-- a file denoted by its capability and which should be called  
"whee.ogg" by your web browser

The "@@name=" is just to warn people that this is a different thing  
from the directory-based URL above, and the "/" is just to trick the  
web browser into using the trailing part as the suggested name.

The thing is that people basically never look into the middle of a  
big ugly URL like that.  Whether is says "uri" or "named" or  
"helpimtrappedinaurlfactory" will usually make no difference to how  
people interpret these URLs.

Hm.  This also suggests that in the new capability encoding that  
we're going to come up with (nice short capabilities, ticket #217),  
we should put the character indicating whether this is a directory or  
a file or whatever at the end of the capability rather than at the  
beginning...

Regards,

Zooko

tickets mentioned in this e-mail:

http://allmydata.org/trac/tahoe/ticket/221 # (give proper filenames  
on download)
http://allmydata.org/trac/tahoe/ticket/217 # (DSA-based mutable files  
-- small URLs, fast file creation)



More information about the tahoe-dev mailing list