Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serving "/" leads to miss the first letter of directory #11

Open
Alveona opened this issue Feb 21, 2020 · 9 comments · May be fixed by #18
Open

Serving "/" leads to miss the first letter of directory #11

Alveona opened this issue Feb 21, 2020 · 9 comments · May be fixed by #18
Assignees
Labels
bug Something isn't working

Comments

@Alveona
Copy link

Alveona commented Feb 21, 2020

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

image

@adeutscher
Copy link

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 adeutscher linked a pull request Feb 25, 2020 that will close this issue
@Alveona
Copy link
Author

Alveona commented Feb 29, 2020

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

@adeutscher
Copy link

On Windows (Python 3.7.6), everything appears to go alright:

  • Running python -m updog -d / shares C:\, and subdirectories can be navigated into.
  • Running python -m updog -d <relative local dir> also works.

@adeutscher
Copy link

@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.

@Alveona
Copy link
Author

Alveona commented Feb 29, 2020

@adeutscher Sounds great! Waiting for @sc0tfree

@sc0tfree
Copy link
Owner

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!

@vient
Copy link

vient commented Jul 21, 2020

dive in ASAP

How is it going?

@dostoevskylabs dostoevskylabs added the bug Something isn't working label Dec 4, 2020
@dostoevskylabs dostoevskylabs self-assigned this Jan 6, 2021
@zhizunbao84
Copy link

zhizunbao84 commented Oct 14, 2021

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 .

微信截图_20211014174609

@zhizunbao84
Copy link

but if i input the subfolder in the address bar of the broswer, everything is ok!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants