diff piecrust/admin/views/edit.py @ 1107:a1c6050c9801

admin: Fix possible crash in the edit page.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 18 Feb 2018 20:31:16 -0800
parents c50ff76e0596
children 0d699f04968c
line wrap: on
line diff
--- a/piecrust/admin/views/edit.py	Sun Feb 18 20:30:22 2018 -0800
+++ b/piecrust/admin/views/edit.py	Sun Feb 18 20:31:16 2018 -0800
@@ -78,7 +78,8 @@
         _, ext = os.path.splitext(filename)
         filename = request.form['ft-asset-name'] + ext
     filename = secure_filename(filename)
-    dirname, _ = os.path.splitext(page.path)
+    # TODO: this only works for FS sources.
+    dirname, _ = os.path.splitext(page.content_spec)
     dirname += '-assets'
     if not os.path.exists(dirname):
         os.makedirs(dirname)