updog
updog copied to clipboard
Serving "/" leads to miss the first letter of directory
As stated, when I try to run updog from root or if I do updog -d /
or updog -d \/
, all links in http interface seems to miss their first letter, like /etc becomes 0.0.0.0:9090/tc and so on
To reproduce:
-
updog -d /
- open web interface
- see what is a http link to /etc - it would be /tc

The hiccup is in the get_relative_path
method:
def get_relative_path(file_path, base_directory):
return file_path.split(os.path.commonprefix([base_directory, file_path]))[1][1:]
Replacing this function with os.path.relpath
seems to fix things.
The hiccup is in the
get_relative_path
method:def get_relative_path(file_path, base_directory): return file_path.split(os.path.commonprefix([base_directory, file_path]))[1][1:]
Replacing this function with
os.path.relpath
seems to fix things.
@adeutscher Could you test it on Windows as well? It seems to also fix #23
On Windows (Python 3.7.6), everything appears to go alright:
- Running
python -m updog -d /
sharesC:\
, and subdirectories can be navigated into. - Running
python -m updog -d <relative local dir>
also works.
@Alveona Also just tested with a specific drive letter, more directly addressing #23.
Sharing with python -m updog -d T:\
successfully shares the T:\ drive on my Windows box and allows me to get into sub-directories.
@adeutscher Sounds great! Waiting for @sc0tfree
Hey @adeutscher and @Alveona - Thanks so much for working through this issue. I’m on a plane home from vacation and will dive in ASAP!
dive in ASAP
How is it going?
On Windows (Python 3.6.8 miniconda virtual env) with updog v1.4, still same error. i test some commands:
python -m updog -d d: -p 1234
python -m updog -d d:\ -p 1234
python -m updog -d d:\\ -p 1234
updog -d d: -p 1234
updog -d d:\ -p 1234
updog -d d:\\ -p 1234
when i want to go into the subfolder, it will miss the first letter of the subfolder's .
but if i input the subfolder in the address bar of the broswer, everything is ok!