From 7672491a3374d0dce45a0a9db2ab2cc4a7dd2944 Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Sat, 26 Jun 2021 23:15:46 +0200 Subject: ACL: handle non-existing resources --- src/scm/webid-oidc/server/resource/wac.scm | 11 ++++++++++- tests/acl.scm | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/scm/webid-oidc/server/resource/wac.scm b/src/scm/webid-oidc/server/resource/wac.scm index e482ce4..b9959f9 100644 --- a/src/scm/webid-oidc/server/resource/wac.scm +++ b/src/scm/webid-oidc/server/resource/wac.scm @@ -183,7 +183,16 @@ (with-session (lambda (content-type contained static-content create delete) (define (wac-check-recursive path check-default?) - (receive (main-etag auxiliary) (read-path path) + (receive (main-etag auxiliary) + (with-exception-handler + (lambda (error) + (unless (path-not-found? error) + (raise-exception error)) + (values #f '())) + (lambda () + (read-path path)) + #:unwind? #t + #:unwind-for-type &path-not-found) (let ((acl-etag (assoc-ref auxiliary acl-aux))) (if acl-etag (with-rdf-source diff --git a/tests/acl.scm b/tests/acl.scm index b582b17..4249e6e 100644 --- a/tests/acl.scm +++ b/tests/acl.scm @@ -53,6 +53,7 @@ ;; /docs/ can only be updated by Alice and the public can list ;; /docs/file1 can only be updated by Alice, but public ;; /docs/file2 same, but authenticated + ;; /fiction/file does not exist, so /#default applies ;; /private-docs/ private to Alice, no ACL ;; /private-docs/file1 no ACL (so, readable by the FBI as inherited in /) ;; /private/docs/file2 no ACL (so, not readable by the FBI) @@ -179,6 +180,7 @@ ;; /docs/ RWC R R R ;; /docs/file1 RWC R R R ;; /docs/file2 RWC R R X + ;; /fiction/file RWC X X X ;; /private-docs/ RWC X X X ;; /private-docs/file1 RWC X RW X ;; /private-docs/file2 RWC X X X @@ -244,6 +246,7 @@ (run-test "/docs/" RWC R R R) (run-test "/docs/file1" RWC R R R) (run-test "/docs/file2" RWC R R X) + (run-test "/fiction/file" RWC X X X) (run-test "/private-docs/" RWC X X X) (run-test "/private-docs/file1" RWC X RW X) (run-test "/private-docs/file2" RWC X X X))))))))) -- cgit v1.2.3