blueswen / mkdocs-swagger-ui-tag

A MkDocs plugin supports adding Swagger UI to the page.
https://blueswen.github.io/mkdocs-swagger-ui-tag/
MIT License
75 stars 7 forks source link

Issue with Special Charaters in Paths #6

Closed mfeisel closed 1 year ago

mfeisel commented 2 years ago

Hi, we have for example a @ in the Pathname of document Directories. This leads this plugin is putting the file swagger-<...>.html in ...%40... Directory. Which then is not found in the resulting webpages.

For me it looks if you change line 98 in plugin.py from

page_dir = os.path.dirname(os.path.join(config['site_dir'], page.url))

to

page_dir = os.path.dirname(os.path.join(config['site_dir'], urlunquote(page.url)))

will fix the issue, but I do not know if there is any other side effect.

Would be great if you can have a look in this. Many thanks. Kind regards

blueswen commented 1 year ago

@mfeisel Thanks for digging into the details.

It seems to work perfectly with urlunquote(urllib.parse.unquote) to deal with the special characters in the path. I fixed this in v0.4.3. Could you check that it is okay in your project?