Revision: 4119
Author: hans
URL: http://bknr.net/trac/changeset/4119
Fix from Anton Vodonosov to ensure that MD5:MD5SUM-SEQUENCE is always passed a simple string.
U trunk/thirdparty/hunchentoot/util.lisp
Modified: trunk/thirdparty/hunchentoot/util.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/util.lisp 2008-12-08 22:05:57 UTC (rev 4118)
+++ trunk/thirdparty/hunchentoot/util.lisp 2008-12-09 05:50:48 UTC (rev 4119)
@@ -144,7 +144,7 @@
(defun md5-hex (string)
"Calculates the md5 sum of the string STRING and returns it as a hex string."
(with-output-to-string (s)
- (loop for code across (md5:md5sum-sequence string)
+ (loop for code across (md5:md5sum-sequence (coerce string 'simple-string))
do (format s "~2,'0x" code))))
(defun escape-for-html (string)
Revision: 4117
Author: hans
URL: http://bknr.net/trac/changeset/4117
Handle wildcarded filenames properly. Requests for files containing
wildcard characters will be responded to with a 404 response code instead
of an error.
U trunk/thirdparty/hunchentoot/misc.lisp
Modified: trunk/thirdparty/hunchentoot/misc.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/misc.lisp 2008-12-05 13:37:32 UTC (rev 4116)
+++ trunk/thirdparty/hunchentoot/misc.lisp 2008-12-08 15:15:24 UTC (rev 4117)
@@ -129,8 +129,9 @@
denoted by PATH. Send a content type header corresponding to
CONTENT-TYPE or \(if that is NIL) tries to determine the content
type via the file's suffix."
- (unless (and (fad:file-exists-p path)
- (not (fad:directory-exists-p path)))
+ (when (or (wild-pathname-p path)
+ (not (fad:file-exists-p path))
+ (fad:directory-exists-p path))
;; does not exist
(setf (return-code) +http-not-found+)
(throw 'handler-done nil))
Revision: 4113
Author: hans
URL: http://bknr.net/trac/changeset/4113
Add new :IF-EXISTS keyword argument to MAKE-STORE-IMAGE that can be
set to control whether an existing image of the same name should be
overwritten.
U trunk/bknr/web/src/images/image.lisp
Modified: trunk/bknr/web/src/images/image.lisp
===================================================================
--- trunk/bknr/web/src/images/image.lisp 2008-12-04 15:02:57 UTC (rev 4112)
+++ trunk/bknr/web/src/images/image.lisp 2008-12-05 09:49:44 UTC (rev 4113)
@@ -65,12 +65,20 @@
name
(type :png)
directory keywords
+ (if-exists :error)
(class-name 'store-image)
initargs)
(unless (scan #?r"\D" name)
(error "invalid image name ~A, needs to contain at least one non-digit character" name))
- (when (store-image-with-name name)
- (error "can't make image with name ~A, an image with this name already exists in the datastore" name))
+ (when-let (existing-image (store-image-with-name name))
+ (ecase if-exists
+ (:error
+ (error "can't make image with name ~A, an image with this name already exists in the datastore" name))
+ (:supersede
+ (delete-object existing-image))
+ (:kill
+ (delete-file (blob-pathname existing-image))
+ (delete-object existing-image))))
(let ((store-image (apply #'make-instance
class-name
:name name