Author: damoxc
Revision: 5104
Log:
fix serving binary files on windows
Diff:
Modified: trunk/deluge/ui/web/server.py
===================================================================
--- trunk/deluge/ui/web/server.py 2009-04-20 20:11:31 UTC (rev 5103)
+++ trunk/deluge/ui/web/server.py 2009-04-20 20:26:03 UTC (rev 5104)
@@ -203,13 +203,15 @@
request.path = path
return self
- def render(self, request):
+ def render(self, request):
+ log.debug("Requested path: '%s'", request.path)
for lookup in self.directories:
if request.path in os.listdir(lookup):
- path = os.path.join(lookup, request.path)
+ path = os.path.join(lookup, request.path)
+ log.debug("Serving path: '%s'", path)
mime_type = mimetypes.guess_type(path)
request.setHeader("content-type", mime_type[0])
- return open(path).read()
+ return open(path, "rb").read()
request.setResponseCode(http.NOT_FOUND)
return "<h1>404 - Not Found</h1>"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---