From 0ba20c9e382fb3278500c0712df3c666a6d05686 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Wed, 8 Feb 2023 19:44:32 +1300 Subject: [PATCH] Match style URLs better in style archive server --- info.rkt | 2 +- src/page-static-archive.rkt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/info.rkt b/info.rkt index dd34d49..4769990 100644 --- a/info.rkt +++ b/info.rkt @@ -1,3 +1,3 @@ #lang info -(define build-deps '("rackunit-lib" "web-server-lib" "http-easy-lib" "html-parsing" "html-writing" "json-pointer" "ini-lib" "memo" "net-cookies-lib")) +(define build-deps '("rackunit-lib" "web-server-lib" "http-easy-lib" "html-parsing" "html-writing" "json-pointer" "typed-ini-lib" "memo" "net-cookies-lib")) diff --git a/src/page-static-archive.rkt b/src/page-static-archive.rkt index a4e145f..0d01a59 100644 --- a/src/page-static-archive.rkt +++ b/src/page-static-archive.rkt @@ -41,14 +41,14 @@ [(string-prefix? url "http://") (regexp-replace #rx"http:" url "https:")] [(string-prefix? url "//") (string-append "https:" url)] [(string-prefix? url "/") (format "https://~a.fandom.com~a" wikiname url)] - [else (raise-user-error "While calling replace-style-for-images, this URL had an unknown format and couldn't be saved:" url)])]) + [else (error 'replace-style-for-images "unknown URL format: ~a" url)])]) (define p (image-url->values norm-url)) ;; (printf "hashed: ~a~n -> ~a~n #-> ~a~n" url (car p) (cdr p)) (format "/archive/~a/images/~a" wikiname (cdr p)))))) (define (replace-style-for-images wikiname path) (define content (file->string path)) - (regexp-replace* #rx"url\\(([^)]*)\\)" content (replacer wikiname))) + (regexp-replace* #rx"url\\(\"?'?([^)]*)'?\"?\\)" content (replacer wikiname))) (define (handle-style wikiname dest) (when (config-true? 'debug)