# HG changeset patch # User Olaf Wintermann # Date 1667313561 -3600 # Node ID d2bfd11d3f8f0882a1f87015af331639a79e1729 # Parent d814b29e8d96a3a49d52fb3069dfa87ff22018fa fix invalid propfind pg queries created for allprop requests on collections diff -r d814b29e8d96 -r d2bfd11d3f8f src/server/plugins/postgresql/webdav.c --- a/src/server/plugins/postgresql/webdav.c Tue Nov 01 15:27:48 2022 +0100 +++ b/src/server/plugins/postgresql/webdav.c Tue Nov 01 15:39:21 2022 +0100 @@ -146,10 +146,10 @@ where r.resource_id = $1 or r.parent_id = $1\n"; static const char *sql_propfind_order_depth1 = "\ -order by case when r.resource_id = $1 then 0 else 1 end, nodename, resource_id"; +order by case when r.resource_id = $1 then 0 else 1 end, r.nodename, r.resource_id"; static const char *sql_propfind_order_depth_infinity = "\ -order by replace(ppath, '/', chr(1)), resource_id"; +order by replace(ppath, '/', chr(1)), r.resource_id"; /* * SQL Queries @@ -389,7 +389,7 @@ // end ucx_buffer_puts(sql, ";\0"); - + return 0; } @@ -544,6 +544,11 @@ ucx_buffer_free(pname_buf); } if(nrows < 1) { + // we resolved the path, so the resource exists and nrows should + // be >= 1 + if(PQresultStatus(result) != PGRES_TUPLES_OK) { + log_ereport(LOG_FAILURE, "pg_dav_propfind_init: %s", PQerrorMessage(pgdav->connection)); + } PQclear(result); return 1; }