Tue, 01 Nov 2022 16:53:11 +0100
add vfs support to find_index
src/server/safs/pathcheck.c | file | annotate | diff | comparison | revisions |
--- a/src/server/safs/pathcheck.c Tue Nov 01 16:40:03 2022 +0100 +++ b/src/server/safs/pathcheck.c Tue Nov 01 16:53:11 2022 +0100 @@ -141,6 +141,15 @@ return REQ_ABORTED; } + // only find index for GET requests + // maybe we want to support find-index for other methods, in that case + // we should implement a parameter for this + char *method = pblock_findkeyval(pb_key_method, rq->reqpb); + if(strcmp(method, "GET")) { + return REQ_NOACTION; + } + + VFSContext *vfs = vfs_request_context(sn, rq); int ret = REQ_NOACTION; char *path = pblock_findkeyval(pb_key_path, rq->vars); @@ -150,7 +159,7 @@ for(int i=0;i<ni;i++) { sstr_t newpath = sstrcat(2, p, sstrtrim(names[i])); struct stat s; - if(!stat(newpath.ptr, &s)) { + if(!vfs_stat(vfs, newpath.ptr, &s)) { pblock_kvinsert( pb_key_path, newpath.ptr,