/file works

This commit is contained in:
meejah 2019-09-10 18:53:54 -06:00
parent c2ff7e260b
commit 8f32936c7a
2 changed files with 4 additions and 5 deletions

View File

@ -521,5 +521,5 @@ def FileReadOnlyURI(req, filenode):
return text_plain(filenode.get_readonly_uri(), req)
class FileNodeDownloadHandler(FileNodeHandler):
def childFactory(self, req, name):
def getChild(self, name, req):
return FileNodeDownloadHandler(self.client, self.node, name=name)

View File

@ -150,16 +150,15 @@ class URIHandler(resource.Resource, object):
)
class FileHandler(rend.Page):
class FileHandler(resource.Resource, object):
# I handle /file/$FILECAP[/IGNORED] , which provides a URL from which a
# file can be downloaded correctly by tools like "wget".
def __init__(self, client):
rend.Page.__init__(self, client)
super(FileHandler, self).__init__()
self.client = client
def childFactory(self, ctx, name):
req = IRequest(ctx)
def getChild(self, name, req):
if req.method not in ("GET", "HEAD"):
raise WebError("/file can only be used with GET or HEAD")
# 'name' must be a file URI