Author: hhubner
Date: 2007-03-25 01:16:51 -0500 (Sun, 25 Mar 2007)
New Revision: 2136
Modified:
trunk/bknr/src/web/handlers.lisp
Log:
Fix long-outstanding bug that prevented uploaded files from being
deleted when the handler detected an error.
Modified: trunk/bknr/src/web/handlers.lisp
===================================================================
--- trunk/bknr/src/web/handlers.lisp 2007-03-24 09:35:15 UTC (rev 2135)
+++ trunk/bknr/src/web/handlers.lisp 2007-03-25 06:16:51 UTC (rev 2136)
@@ -229,22 +229,23 @@
(*req-var-hash* (or *req-var-hash*
(make-hash-table))))
(do-log-request req)
- (if (not (authorized-p handler req))
- (progn
- (setf (session-variable :login-redirect-uri)
- (redirect-uri (request-uri req)))
- (redirect (website-make-path *website* "login") req))
- (if (member :notrap net.aserve::*debug-current* :test #'eq)
- (handle handler req)
- (handler-bind ((error #'(lambda (e)
- (funcall (website-show-error-page-function *website*) e)
- (do-error-log-request req e)
- (error e))))
- (handle handler req))))
- (handler-case
- (mapcar #'delete-file (mapcar #'cdr (request-uploaded-files req)))
- (error (e)
- (warn "error ~A ignored while deleting uploaded files" e)))))
+ (unwind-protect
+ (if (not (authorized-p handler req))
+ (progn
+ (setf (session-variable :login-redirect-uri)
+ (redirect-uri (request-uri req)))
+ (redirect (website-make-path *website* "login") req))
+ (if (member :notrap net.aserve::*debug-current* :test #'eq)
+ (handle handler req)
+ (handler-bind ((error #'(lambda (e)
+ (funcall (website-show-error-page-function *website*) e)
+ (do-error-log-request req e)
+ (error e))))
+ (handle handler req))))
+ (handler-case
+ (mapcar #'delete-file (mapcar #'cdr (request-uploaded-files req)))
+ (error (e)
+ (warn "error ~A ignored while deleting uploaded files" e))))))
(defmethod handle ((page-handler page-handler) req)
(funcall (page-handler-function page-handler) req))