mirror of
https://gitdab.com/cadence/breezewiki.git
synced 2026-04-18 21:54:34 -04:00
Match style URLs better in style archive server
This commit is contained in:
@@ -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"))
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user