-
Notifications
You must be signed in to change notification settings - Fork 977
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: zola serve no longer includes output directory content because of path canonicalization mismatch #2398
Conversation
11b265b
to
ac4c54d
Compare
This fixes a bug introduced in getzola#2258 The issue arose when `output_path` was relative. The request being served would be canonicalized and this would be a string. So, for example, if you were serving content from `public` the code [right after](https://github.com/getzola/zola/blob/38199c125501e9ff0e700e96adaca72cc3f25d2b/src/cmd/serve.rs#L144-L147) the canonicalization checking if `root.starts_with(original_root)` would always return `false` since an absolute path, `/some/path/to/content` would never start with a string like `public`.
ac4c54d
to
df19f5e
Compare
Thanks! |
The Windows build of next on my machine, crashes on the line of this patch: Line 470 in 42fc576
The last bit meaning "Incorrect function" This occurs with both the
If you need more info, let me know. Else tomorrow I'll explore some more.
|
Not sure if this is related (I don't have access to test on a windows machine), but I found this one other issue about where |
This fixes a bug introduced in getzola#2258 The issue arose when `output_path` was relative. The request being served would be canonicalized and this would be a string. So, for example, if you were serving content from `public` the code [right after](https://github.com/getzola/zola/blob/38199c125501e9ff0e700e96adaca72cc3f25d2b/src/cmd/serve.rs#L144-L147) the canonicalization checking if `root.starts_with(original_root)` would always return `false` since an absolute path, `/some/path/to/content` would never start with a string like `public`.
This fixes a bug introduced in #2258 The issue arose when `output_path` was relative. The request being served would be canonicalized and this would be a string. So, for example, if you were serving content from `public` the code [right after](https://github.com/getzola/zola/blob/38199c125501e9ff0e700e96adaca72cc3f25d2b/src/cmd/serve.rs#L144-L147) the canonicalization checking if `root.starts_with(original_root)` would always return `false` since an absolute path, `/some/path/to/content` would never start with a string like `public`.
This fixes a bug introduced in getzola#2258 The issue arose when `output_path` was relative. The request being served would be canonicalized and this would be a string. So, for example, if you were serving content from `public` the code [right after](https://github.com/getzola/zola/blob/38199c125501e9ff0e700e96adaca72cc3f25d2b/src/cmd/serve.rs#L144-L147) the canonicalization checking if `root.starts_with(original_root)` would always return `false` since an absolute path, `/some/path/to/content` would never start with a string like `public`.
This fixes a bug introduced in #2258
The issue arose when
output_path
was relative. The request being served would be canonicalized and this would be a string. So, for example, if you were serving content frompublic
the code right after the canonicalization checking ifroot.starts_with(original_root)
would always returnfalse
since an absolute path,/some/path/to/content
would never start with a string likepublic
.Sanity check:
Code changes
(Delete or ignore this section for documentation changes)
next
branch?If the change is a new feature or adding to/changing an existing one: