Replace uses of os.path.join in URL contexts with something more appropriate. #255

Open
spladug opened this Issue Nov 16, 2011 · 3 comments

Comments

Projects
None yet
2 participants
Owner

spladug commented Nov 16, 2011

Semantically, os.path.join is the wrong choice for joining URL path components since it is OS-specific in its behaviour. This should be replaced with something that will be correct regardless when building paths for URLs.

Contributor

kemitche commented Nov 16, 2011

'/'.join(list_of_stuff)

s/os.path.join/'/'.join/g

Owner

spladug commented Nov 16, 2011

No, that doesn't take care of strings that already have slashes in them, etc.

That lack of normalization broke the geoip stuff because the ini file setting had a slash at the end which resulted in a url like job-01//file which flask didn't like. I'd rather not end up in a situation where our config options are that persnickity again.

@k21 k21 added a commit to k21/reddit that referenced this issue Jan 6, 2012

@k21 k21 Fix issue #255, create function url_join c479b25
Owner

spladug commented Nov 19, 2014

posixpath.join is the answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment