This commit is contained in:
2025-03-29 07:34:15 +01:00
parent 638f81a781
commit be54ec8302
3 changed files with 36 additions and 0 deletions

BIN
examples/webdav/webdav_vfs Executable file

Binary file not shown.

View File

@@ -325,6 +325,14 @@ fn (p SupportedLock) xml_str() string {
}
fn (p LockDiscovery) xml() xml.XMLNodeContents {
// If p is empty, return an empty lockdiscovery element
if p == '' {
return xml.XMLNode{
name: 'D:lockdiscovery'
}
}
// Otherwise, return the lockdiscovery with the lock information
return xml.XMLNode{
name: 'D:lockdiscovery'
children: [xml.XMLNodeContents(p)]

View File

@@ -70,6 +70,34 @@ fn (mut server Server) get_entry_property(entry &vfs.FSEntry, name string) !Prop
'quota-used-bytes' { Property(QuotaUsedBytes(16184098816)) }
'quotaused' { Property(QuotaUsed(16184098816)) }
'quota' { Property(Quota(16184098816)) }
'displayname' {
// RFC 4918, Section 15.2: displayname is a human-readable name for UI display
// For now, we use the filename as the displayname, but this could be enhanced
// to support custom displaynames stored in metadata or configuration
Property(DisplayName(entry.get_metadata().name))
}
'getcontenttype' {
// RFC 4918, Section 15.5: getcontenttype contains the Content-Type header value
// For collections (directories), return httpd/unix-directory
// For files, determine the MIME type based on file extension
mut content_type := ''
if entry.is_dir() {
content_type = 'httpd/unix-directory'
} else {
content_type = get_file_content_type(entry.get_metadata().name)
}
Property(GetContentType(content_type))
}
'lockdiscovery' {
// RFC 4918, Section 15.8: lockdiscovery provides information about locks
// Always show as unlocked for now to ensure compatibility
Property(LockDiscovery(''))
}
's:lastmodified_server' {
// This appears to be a custom property requested by some WebDAV clients
// Return the last modified time of the resource
Property(GetLastModified(texttools.format_rfc1123(entry.get_metadata().modified_time())))
}
else { panic('implement ${name}') }
}
}