[tahoe-dev] wanted in webapi: a way to download a file only if it is a file
zooko
zooko at zooko.com
Thu Aug 9 14:55:39 PDT 2007
So I'm implementing the recursive get feature of the command-line
interface, and I learned that there is a subtle issue in the webapi.
Suppose you are asked to download something, and if it is a file you
are supposed to just download it, but if it is a directory you are
supposed to recursively download its contents.
You could check whether it is a file or not with "GET URL?t=json" and
then if it is a file download it with "GET URL", but vdrives can be
mutable, and there's the possibility that between the time you
checked and the time you downloaded it someone replaced the file with
a directory. The desired behavior if that happened is that you
should recursively download the contents of the new directory, but
with the current webapi what will happen is that you download a human-
oriented HTML page describing the directory and offering forms for
manipulating it!
This calls out for a flag, such as "GET URL?t=file", which would
cause the server to return an error if the thing at URL is not a file.
Would that be a complete fix for this sort of problem in using webapi?
Thanks!
Regards,
Zooko
More information about the tahoe-dev
mailing list