mirror of
https://github.com/neocities/neocities.git
synced 2026-05-26 15:18:35 +00:00
Merge branch 'dav2fs-fix'
This commit is contained in:
@@ -46,7 +46,7 @@ map '/webdav' do
|
||||
|
||||
case request_method
|
||||
when 'OPTIONS'
|
||||
return [200, {'Allow' => 'OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MOVE', 'DAV' => '1,2'}, ['']]
|
||||
return [200, {'Allow' => 'OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MOVE', 'DAV' => '1'}, ['']]
|
||||
|
||||
when 'GET', 'HEAD'
|
||||
begin
|
||||
@@ -86,6 +86,10 @@ map '/webdav' do
|
||||
'Last-Modified' => last_modified.httpdate
|
||||
}
|
||||
|
||||
if site_file&.sha1_hash
|
||||
headers['ETag'] = %("#{site_file.sha1_hash}")
|
||||
end
|
||||
|
||||
if request_method == 'HEAD'
|
||||
return [200, headers, []]
|
||||
end
|
||||
@@ -205,7 +209,7 @@ map '/webdav' do
|
||||
</D:multistatus>
|
||||
XML
|
||||
|
||||
return [207, {'Content-Type' => 'application/xml; charset=utf-8', 'DAV' => '1,2'}, [xml]]
|
||||
return [207, {'Content-Type' => 'application/xml; charset=utf-8', 'DAV' => '1'}, [xml]]
|
||||
|
||||
when 'PUT'
|
||||
tmpfile = Tempfile.new('davfile', encoding: 'binary')
|
||||
|
||||
@@ -1306,6 +1306,7 @@ class Site < Sequel::Model
|
||||
file[:size] = site_file.size unless file[:is_directory]
|
||||
file[:created_at] = site_file.created_at
|
||||
file[:updated_at] = site_file.updated_at ? site_file.updated_at : site_file.created_at
|
||||
file[:sha1_hash] = site_file.sha1_hash
|
||||
end
|
||||
|
||||
file[:is_html] = !(extname.match(HTML_REGEX)).nil?
|
||||
|
||||
Reference in New Issue
Block a user