mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 04:51:11 -05:00
14 lines
420 B
PL/PgSQL
14 lines
420 B
PL/PgSQL
-- Fix security warning: Set search_path on extract_cf_image_id function
|
|
CREATE OR REPLACE FUNCTION extract_cf_image_id(url TEXT)
|
|
RETURNS TEXT
|
|
LANGUAGE plpgsql
|
|
IMMUTABLE
|
|
SECURITY DEFINER
|
|
SET search_path = public
|
|
AS $$
|
|
BEGIN
|
|
-- Extract ID from imagedelivery.net URL pattern
|
|
-- Pattern: https://imagedelivery.net/{account-hash}/{image-id}/{variant}
|
|
RETURN (regexp_match(url, '/([a-f0-9-]+)/[a-z0-9]+$'))[1];
|
|
END;
|
|
$$; |