]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/web-cmd.py
bup-web: handle 4 item getsockname() result for IPv6 sockets
[bup.git] / lib / cmd / web-cmd.py
index 8c084c17b771d64585805ad81013e5817ad564d1..77e5de068c96775255009bd6c3cae095283edb2b 100755 (executable)
@@ -9,7 +9,7 @@ for arg in "$@"; do
     arg_i=$((arg_i + 1))
 done
 # Here to end of preamble replaced during install
-bup_python="$(dirname "$0")/bup-python" || exit $?
+bup_python="$(dirname "$0")/../../config/bin/python" || exit $?
 exec "$bup_python" "$0"
 """
 # end of bup preamble
@@ -19,6 +19,8 @@ from collections import namedtuple
 import mimetypes, os, posixpath, signal, stat, sys, time, urllib, webbrowser
 from binascii import hexlify
 
+sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
+
 from bup import compat, options, git, vfs
 from bup.helpers import (chunkyreader, debug1, format_filesize, handle_ctrl_c,
                          log, saved_errors)
@@ -116,8 +118,7 @@ def _dir_contents(repo, resolution, show_hidden=False):
             parent_item = resolution[-2][1] if len(resolution) > 1 else dir_item
             yield display_info(b'..', parent_item, parent_item, b'..')
             continue
-        res = vfs.try_resolve(repo, name, parent=resolution, want_meta=False)
-        res_name, res_item = res[-1]
+        res_item = vfs.ensure_item_has_metadata(repo, item, include_size=True)
         yield display_info(name, item, res_item)
 
 
@@ -307,7 +308,7 @@ io_loop_pending = IOLoop.instance()
 if isinstance(address, InetAddress):
     sockets = tornado.netutil.bind_sockets(address.port, address.host)
     http_server.add_sockets(sockets)
-    print('Serving HTTP on %s:%d...' % sockets[0].getsockname())
+    print('Serving HTTP on %s:%d...' % sockets[0].getsockname()[0:2])
     if opt.browser:
         browser_addr = 'http://' + address[0] + ':' + str(address[1])
         io_loop_pending.add_callback(lambda : webbrowser.open(browser_addr))