From f7d7da6aceb407b719cf4683a75878fd3aca319e Mon Sep 17 00:00:00 2001 From: sterni Date: Wed, 12 Jan 2022 18:58:21 +0100 Subject: fix(users/sterni/mblog): use string-equal where casing is irrelevant Change-Id: Ic1303a04de005977a552eba38aa13d512d2c20e2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5071 Tested-by: BuildkiteCI Reviewed-by: sterni --- users/sterni/mblog/note.lisp | 8 ++++---- users/sterni/mblog/transformer.lisp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'users/sterni') diff --git a/users/sterni/mblog/note.lisp b/users/sterni/mblog/note.lisp index fa4de0956f..660b4826b1 100644 --- a/users/sterni/mblog/note.lisp +++ b/users/sterni/mblog/note.lisp @@ -23,8 +23,8 @@ to determine if a given mime message is an Apple Note." (when-let (uniform-id (assoc "X-Uniform-Type-Identifier" (mime:mime-message-headers msg) - :test #'string=)) - (string= (cdr uniform-id) "com.apple.mail-note"))) + :test #'string-equal)) + (string-equal (cdr uniform-id) "com.apple.mail-note"))) (defun apple-note-html-fragment (msg out) "Takes a MIME:MIME-MESSAGE and writes its text content as HTML to @@ -42,10 +42,10 @@ ((not text) (error "Malformed Apple Note: no text part")) ;; notemap creates text/plain notes we need to handle properly. ;; Additionally we *could* check X-Mailer which notemap sets - ((string= (mime:mime-subtype text) "plain") + ((string-equal (mime:mime-subtype text) "plain") (html-escape-stream (mime:mime-body-stream text :binary nil) out)) ;; Notes.app creates text/html parts - ((string= (mime:mime-subtype text) "html") + ((string-equal (mime:mime-subtype text) "html") (closure-html:parse (mime:mime-body-stream text) (make-instance diff --git a/users/sterni/mblog/transformer.lisp b/users/sterni/mblog/transformer.lisp index f26c5652a2..67f1ff0e1d 100644 --- a/users/sterni/mblog/transformer.lisp +++ b/users/sterni/mblog/transformer.lisp @@ -60,7 +60,7 @@ (defun parse-content-id (attrlist) (when-let (data (find-if (lambda (x) - (string= (hax:attribute-name x) "DATA")) + (string-equal (hax:attribute-name x) "DATA")) attrlist)) (multiple-value-bind (starts-with-cid-p suffix) (starts-with-subseq "cid:" (hax:attribute-value data) @@ -81,16 +81,16 @@ ;; If we are not discarding any outer elements, we can set ;; up a new discard condition if we encounter an appropriate ;; element. - ((member name +discard-tags-with-children+ :test #'string=) + ((member name +discard-tags-with-children+ :test #'string-equal) (setf discard-until (cons name depth))) ;; Only drop this event, must be mirrored in END-ELEMENT to ;; avoid invalidly nested HTML. - ((member name +discard-tags-only+ :test #'string=) nil) + ((member name +discard-tags-only+ :test #'string-equal) nil) ;; If we encounter an object tag, we drop it and its contents, ;; but only after inspecting its attributes and emitting new ;; events representing an img tag which includes the respective ;; attachment via its filename. - ((string= name "OBJECT") + ((string-equal name "OBJECT") (progn (setf discard-until (cons "OBJECT" depth)) ;; TODO(sterni): check type and only resolve images, raise error @@ -116,12 +116,12 @@ ;; If we are discarding and encounter the same tag again at the same ;; depth, we can stop, but still have to discard the current tag. ((and discard-until - (string= (car discard-until) name) + (string-equal (car discard-until) name) (= (cdr discard-until) depth)) (setf discard-until nil)) ;; In all other cases, we drop properly. (discard-until nil) ;; Mirrored tag stripping as in START-ELEMENT - ((member name +discard-tags-only+ :test #'string=) nil) + ((member name +discard-tags-only+ :test #'string-equal) nil) ;; In all other cases, we use HAX-PROXY-HANDLER to pass the event on. (t (call-next-method))))) -- cgit 1.4.1