-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
Disable watch to prevent race condition between threads calling site.process #320
Changes from 1 commit
fd83a67
1203e14
9e7b78d
efd6ede
4ce5082
c43c34e
0c170bd
82aba50
a573bb5
87f8e2b
9514901
2bf85ae
3652c41
f4d94ab
1d5a49b
5a87555
e26934f
7d086f2
c8fab6c
e1af381
28c4f9c
1f8c8c2
bce59f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,9 @@ class Server < Sinatra::Base | |
end | ||
|
||
write_file(write_path, document_body) | ||
updated_document = collection.docs.find { |d| d.path == write_path } | ||
updated_document = Jekyll::Document.new(write_path, { | ||
:collection => collection, :site => site, | ||
}).tap(&:read) | ||
render_404 if updated_document.nil? | ||
json updated_document.to_api(:include_content => true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be |
||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,9 @@ class Server < Sinatra::Base | |
end | ||
|
||
write_file(write_path, page_body) | ||
updated_page = pages.find { |p| p.path == write_path } | ||
updated_page = Jekyll::Page.new( | ||
site, site.source, File.dirname(write_path), File.basename(write_path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the path sanitized prior to being read? (to prevent directory traversal from the user-supplied There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @benbalter The |
||
) | ||
render_404 if updated_page.nil? | ||
json updated_page.to_api(:include_content => true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be |
||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we rename
updated_document
todocument
, we can useensure_document
which does the same thing. Same forensure_page
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We won't be able to do this, because
ensure_document
callsdocument
, which uses the buggy way of reading:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't
document
overwritten byJekyll::Document.new
? Soensure_document
uses newly created document object instead of the result object ofdocument
method.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing methods' priority is higher over objects in ruby so it will use
document
method anyway?