diff MoinMoin/formatter/text_html.py @ 281:8155e50e94ca

fixed crash with non-ASCII attachment filename imported from: moin--main--1.5--patch-285
author Thomas Waldmann <tw@waldmann-edv.de>
date Sun, 04 Dec 2005 11:40:42 +0000
parents 85458b71e188
children 7ce195b2189a
line wrap: on
line diff
--- a/MoinMoin/formatter/text_html.py	Sun Dec 04 10:34:44 2005 +0000
+++ b/MoinMoin/formatter/text_html.py	Sun Dec 04 11:40:42 2005 +0000
@@ -340,13 +340,13 @@
         pagename, filename = AttachFile.absoluteName(url, self.page.page_name)
         fname = wikiutil.taintfilename(filename)
         drawing = fname
-        fname = fname + ".png"
-        filename = filename + ".png"
+        fname = fname + u".png"
+        filename = filename + u".png"
         # fallback for old gif drawings (1.1 -> 1.2)
         fpath = AttachFile.getFilename(self.request, pagename, fname)
         if not os.path.exists(fpath):
-            gfname = fname[:-4] + ".gif"
-            gfilename = filename[:-4] + ".gif"
+            gfname = fname[:-4] + u".gif"
+            gfilename = filename[:-4] + u".gif"
             gfpath = AttachFile.getFilename(self.request, pagename, gfname)
             if os.path.exists(gfpath):
                 fname, filename, fpath = gfname, gfilename, gfpath
@@ -362,7 +362,7 @@
                   drawing and ('&drawing=%s' % wikiutil.url_quote(drawing)) or '')),
                 linktext % {'filename': self.text(fname)})
 
-        mappath = AttachFile.getFilename(self.request, pagename, drawing + '.map')
+        mappath = AttachFile.getFilename(self.request, pagename, drawing + u'.map')
         edit_link = ('%s?action=AttachFile&rename=%s&drawing=%s' % (
             wikiutil.quoteWikinameURL(pagename),
             wikiutil.url_quote_plus(fname),