src/server/plugins/postgresql/vfs.c

branch
webdav
changeset 379
4e2cb3adc0f2
parent 374
77506ec632a4
child 382
9e2289c77b04
--- a/src/server/plugins/postgresql/vfs.c	Thu Aug 18 16:48:23 2022 +0200
+++ b/src/server/plugins/postgresql/vfs.c	Thu Aug 18 16:54:57 2022 +0200
@@ -32,6 +32,7 @@
 #include <inttypes.h>
 
 #include "../../util/util.h"
+#include "../../util/pblock.h"
 
 static VFS pg_vfs_class = {
     pg_vfs_open,
@@ -615,6 +616,19 @@
         }
     }
     
+    // store the resource_id in rq->vars
+    if(ctx->rq) {
+        char *rq_path = pblock_findkeyval(pb_key_path, ctx->rq->vars);
+        if(rq_path && !strcmp(rq_path, path)) {
+            char *res_id_str = pblock_findval("resource_id", ctx->rq->vars);
+            if(!res_id_str) {
+                char resource_id_str[32];
+                snprintf(resource_id_str, 32, "%" PRId64, resource_id);
+                pblock_nvinsert("resource_id",resource_id_str, ctx->rq->vars);
+            }
+        }
+    }
+    
     VFSFile *file = pool_malloc(ctx->pool, sizeof(VFSFile));
     if(!file) {
         return NULL;

mercurial