8000 Diferent behaviour if du arguments has a final slash · Issue #4 · fjorba/dircloud · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Diferent behaviour if du arguments has a final slash #4
Open
@funollet

Description

@funollet

Two test files have been generated on my system with

$ du /boot > test1
$ du /boot/ > test2

I created a couple of tests, checking that read_du_file_maybe() generates the same dictionary for both. You can find the test code and the generated files on my fork (just run py.test on the dircloud root directory).

dircloud runs ok with the first file; visiting `http://localhost:2010:/boot/' gets:

$ ./dircloud.py tests/fixtures/du.boot

Bottle server starting up (using WSGIRefServer())...
Listening on http://localhost:2010/
Hit Ctrl-C to quit.

dirpath = [boot/]
localhost - - [20/Feb/2012 17:04:24] "GET /boot/ HTTP/1.1" 200 3468

While the other file raises an exception for the same request:

$ ./dircloud.py tests/fixtures/du.boot_with_final_slash 

Bottle server starting up (using WSGIRefServer())...
Listening on http://localhost:2010/
Hit Ctrl-C to quit.

dirpath = [boot/]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 737, in _handle
    return route.call(**args)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 1456, in wrapper
    rv = callback(*a, **ka)
  File "./dircloud.py", line 106, in dircloud
    search='', body=cloud, footer=footer)
  File "./dircloud.py", line 312, in make_html_page
    filesize = du[dirpath.rstrip(read_from_disk)]
KeyError: 'boot/'
localhost - - [20/Feb/2012 17:04:34] "GET /boot/ HTTP/1.1" 500 1416

I've added a print du just before the line raising the exception. I don't fully understand why, but that's what it shows:

{'boot/grub/locale/': 16384, 'boot//': 138924032, 'boot/grub/': 4460544}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0