Skip to content

Commit

Permalink
Replaced split with shlex.split
Browse files Browse the repository at this point in the history
Amended the file path derivation from permalink so it handles paths which end in a file extension
  • Loading branch information
hooli authored and posativ committed May 26, 2013
1 parent 3ee5aa0 commit 0190ca9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions acrylamid/tasks/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import tempfile
import subprocess
import shutil
import shlex

from os.path import join, dirname, isfile
from os.path import join, dirname, isfile, splitext
from datetime import datetime

from acrylamid import PY3, log, readers, commands, utils
Expand Down Expand Up @@ -52,7 +53,7 @@ def run(conf, env, options):
f.write(tt(title, datetime.now().strftime(conf['date_format'])))

entry = readers.Entry(tmp, conf)
p = join(conf['content_dir'], dirname(entry.permalink)[1:])
p = join(conf['content_dir'], splitext(entry.permalink.strip('/'))[0])

try:
os.makedirs(p.rsplit('/', 1)[0])
Expand All @@ -73,7 +74,7 @@ def run(conf, env, options):

try:
if editor:
retcode = subprocess.call(editor.split() + [filepath])
retcode = subprocess.call(shlex.split(editor) + [filepath])
elif sys.platform == 'darwin':
retcode = subprocess.call(['open', filepath])
else:
Expand Down

0 comments on commit 0190ca9

Please sign in to comment.