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

Fix redirection and file path handling for URL with query strings #111

Merged
merged 3 commits into from
Oct 6, 2020

Conversation

tkf
Copy link
Contributor

@tkf tkf commented Oct 6, 2020

This PR closes #110

Changes:

  • /a/b?c=d is redirected to /a/b/?c=d
  • /a/b/?c=d serves /a/b/index.html

fs_path = joinpath(r_parts...)
if !isempty(CONTENT_DIR[])
fs_path = joinpath(CONTENT_DIR[], fs_path)
end
# if no file is specified, try to append `index.html` and see
endswith(req_path, "/") && (fs_path = joinpath(fs_path, "index.html"))
endswith(uri.path, "/") && (fs_path = joinpath(fs_path, "index.html"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2020

Codecov Report

Merging #111 into master will increase coverage by 0.21%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #111      +/-   ##
==========================================
+ Coverage   85.55%   85.76%   +0.21%     
==========================================
  Files           4        4              
  Lines         263      267       +4     
==========================================
+ Hits          225      229       +4     
  Misses         38       38              
Impacted Files Coverage Δ
src/server.jl 82.94% <85.71%> (+0.54%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52b4efa...72a239d. Read the comment docs.

@tlienart
Copy link
Collaborator

tlienart commented Oct 6, 2020

Thanks a lot! I'll look into how you tackled this a bit later and will merge 🙌🏼

@tlienart tlienart merged commit 6dd3e26 into JuliaDocs:master Oct 6, 2020
@tkf tkf deleted the append_slash branch October 6, 2020 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LiveServer.serve redirects /page/?query=string to /page/?query=string/
3 participants