From 17a240cf5bf3adfcb40bc6bc9dcc9af57048e78b Mon Sep 17 00:00:00 2001 From: Lacanoid Date: Thu, 3 Jun 2021 04:31:38 +0200 Subject: [PATCH] remove automatic tokens for integrity=SELECTIVE --- CHANGELOG.md | 2 +- datalink.sql | 4 ++-- test/expected/other.out | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9447e78..224b8b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ Version 0.13 - trim trailing / on directory names for FS datalinks for better file name uniqueness - dlnewcopy() now stores old token in link - dlpreviouscopy() looks for this old token first -- store curl_head response code in datalink. This helps in finding broken links and such. +- store curl_head response code in datalink Version 0.12 ------------ diff --git a/datalink.sql b/datalink.sql index 023639a..08490be 100644 --- a/datalink.sql +++ b/datalink.sql @@ -875,14 +875,14 @@ begin if link_options > 0 then lco = datalink.link_control_options(link_options); if lco.integrity <> 'NONE' then - if lco.integrity = 'ALL' and dlurlscheme($1)<>'file' then + if lco.integrity = 'ALL' and dlurlscheme(link)<>'file' then raise exception 'INTEGRITY ALL can only be used with file URLs' using errcode = 'HW005', detail = url, hint = 'make sure you are using a file: URL scheme'; end if; -- check if reference exists - has_token := 1; + if lco.integrity = 'ALL' then has_token := 1; end if; r := datalink.curl_get(url,true); if not r.ok then raise exception 'datalink exception - referenced file does not exist' diff --git a/test/expected/other.out b/test/expected/other.out index 0fcc944..cc77f53 100644 --- a/test/expected/other.out +++ b/test/expected/other.out @@ -42,8 +42,8 @@ PL/pgSQL function dl_trigger_table() line 49 at assignment select dlurlcomplete(link), (link)->>'token' is not null as has_token from sample_datalinks2; dlurlcomplete | has_token -------------------------+----------- - file:///etc | t - https://www.debian.org/ | t + file:///etc | f + https://www.debian.org/ | f (2 rows) create table sample_datalinks3 as