You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IINM, the $fieldTypes property is never updated with new metadata created. And, this prevents the SearchBuilder::getExtraOperatorField() function to work for custom metadata.
Here's a comparaison of 2 webDAV searches, one made on an unmodified server, and the second one with a small change:
webDAV SEARCH with unmodified code (Result = Internale Server Error)
root@2408LC07E43:/home/cybo# curl --noproxy 127.0.0.1 -X SEARCH http://127.0.0.1/nc29/remote.php/dav/ -H "OCS-APIRequest: true" -H "Content-Type: application/xml" -H "Authorization: Bearer Kgpk8-wfaCe-YcYNe-em57q-SxW7Q" -d @search.xml -b "XDEBUG_TRIGGER=TRUE"
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Internal Server Error</s:exception>
<s:message>
The server was unable to complete your request. If this happens again, please send the technical details below to the server administrator. More details can be found in the server log. </s:message>
<s:technical-details>
<s:remote-address>127.0.0.1</s:remote-address>
<s:request-id>wuB9fQJtrhIkHbecYM14</s:request-id>
</s:technical-details>
</d:error>
And I find the following line in the log:
{"reqId":"YaJRZO52krqTmEcbbOOZ","level":3,"time":"2025-01-21T19:08:28+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"webdav","method":"SEARCH","url":"/nc29/remote.php/dav/","message":"OC\\Files\\Cache\\SearchBuilder::getParameterForValue(): Argument #3 ($paramType) must be of type string, null given, called in /var/www/nc29/lib/private/Files/Cache/SearchBuilder.php on line 190","userAgent":"curl/7.88.1","version":"29.0.7.1","exception":{"Exception":"TypeError","Message":"OC\\Files\\Cache\\SearchBuilder::getParameterForValue(): Argument #3 ($paramType) must be of type string, null given, called in /var/www/nc29/lib/private/Files/Cache/SearchBuilder.php on line 190","Code":0,"Trace":[{"file":"/var/www/nc29/lib/private/Files/Cache/SearchBuilder.php","line":190,"function":"getParameterForValue","class":"OC\\Files\\Cache\\SearchBuilder","type":"->"},{"file":"/var/www/nc29/lib/private/Files/Cache/SearchBuilder.php","line":170,"function":"searchComparisonToDBExpr","class":"OC\\Files\\Cache\\SearchBuilder","type":"->"},{"file":"/var/www/nc29/lib/private/Files/Cache/SearchBuilder.php","line":137,"function":"searchOperatorToDBExpr","class":"OC\\Files\\Cache\\SearchBuilder","type":"->"},{"function":"OC\\Files\\Cache\\{closure}","class":"OC\\Files\\Cache\\SearchBuilder","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nc29/lib/private/Files/Cache/SearchBuilder.php","line":136,"function":"array_map"},{"file":"/var/www/nc29/lib/private/Files/Cache/SearchBuilder.php","line":163,"function":"searchOperatorArrayToDBExprArray","class":"OC\\Files\\Cache\\SearchBuilder","type":"->"},{"file":"/var/www/nc29/lib/private/Files/Cache/QuerySearchHelper.php","line":89,"function":"searchOperatorToDBExpr","class":"OC\\Files\\Cache\\SearchBuilder","type":"->"},{"file":"/var/www/nc29/lib/private/Files/Cache/QuerySearchHelper.php","line":192,"function":"applySearchConstraints","class":"OC\\Files\\Cache\\QuerySearchHelper","type":"->"},{"file":"/var/www/nc29/lib/private/Files/Node/Folder.php","line":239,"function":"searchInCaches","class":"OC\\Files\\Cache\\QuerySearchHelper","type":"->"},{"file":"/var/www/nc29/apps/dav/lib/Files/FileSearchBackend.php","line":188,"function":"search","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/nc29/apps/dav/lib/Files/LazySearchBackend.php","line":62,"function":"search","class":"OCA\\DAV\\Files\\FileSearchBackend","type":"->"},{"file":"/var/www/nc29/3rdparty/icewind/searchdav/src/DAV/SearchHandler.php","line":82,"function":"search","class":"OCA\\DAV\\Files\\LazySearchBackend","type":"->"},{"file":"/var/www/nc29/3rdparty/icewind/searchdav/src/DAV/SearchPlugin.php","line":119,"function":"handleSearchRequest","class":"SearchDAV\\DAV\\SearchHandler","type":"->"},{"file":"/var/www/nc29/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"searchHandler","class":"SearchDAV\\DAV\\SearchPlugin","type":"->"},{"file":"/var/www/nc29/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nc29/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nc29/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nc29/apps/dav/lib/Server.php","line":383,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nc29/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nc29/remote.php","line":172,"args":["/var/www/nc29/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nc29/lib/private/Files/Cache/SearchBuilder.php","Line":326,"message":"OC\\Files\\Cache\\SearchBuilder::getParameterForValue(): Argument #3 ($paramType) must be of type string, null given, called in /var/www/nc29/lib/private/Files/Cache/SearchBuilder.php on line 190","exception":{},"CustomMessage":"OC\\Files\\Cache\\SearchBuilder::getParameterForValue(): Argument #3 ($paramType) must be of type string, null given, called in /var/www/nc29/lib/private/Files/Cache/SearchBuilder.php on line 190"}}
webDAV SEARCH with modified code (Result = Search successfull)
The full reproduction scenario is quite big since it requires to create an app that initializes our new metadata, issue a PROPPATCH to a file to add it the metadata, and eventually perform the SEARCH, but I believe the bug description should be enough for you to validate the bug (or not if my assumption that the $fieldTypes property is never changed is false).
Unfortunately, I don't have a solution on hand to offer you: It seems a bit complicated to fix at first sight.
Expected behavior
User should be able to search on custom metadata
Nextcloud Server version
29
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Default user-backend (database)
LDAP/ Active Directory
SSO - SAML
Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
The text was updated successfully, but these errors were encountered:
Bug description
Hello,
According to the documentation (https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/files-metadata.html#webdav-search-based-on-metadata) it should be possible to search on custom metadata, but according to my investigation and the code at https://raw.githubusercontent.com/nextcloud/server/refs/heads/master/lib/private/Files/Cache/SearchBuilder.php this is not the case.
IINM, the
$fieldTypes
property is never updated with new metadata created. And, this prevents theSearchBuilder::getExtraOperatorField()
function to work for custom metadata.Here's a comparaison of 2 webDAV searches, one made on an unmodified server, and the second one with a small change:
webDAV SEARCH with unmodified code (Result = Internale Server Error)
And I find the following line in the log:
webDAV SEARCH with modified code (Result = Search successfull)
Here's what I've changed to the SearchBuilder class to make the call work:
Body of the webDAV SEARCH request
For the record, here's the body of the webDAV SEARCH request:
Steps to reproduce
The full reproduction scenario is quite big since it requires to create an app that initializes our new metadata, issue a PROPPATCH to a file to add it the metadata, and eventually perform the SEARCH, but I believe the bug description should be enough for you to validate the bug (or not if my assumption that the
$fieldTypes
property is never changed is false).Unfortunately, I don't have a solution on hand to offer you: It seems a bit complicated to fix at first sight.
Expected behavior
User should be able to search on custom metadata
Nextcloud Server version
29
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
The text was updated successfully, but these errors were encountered: