Fix #1127666 (Recipes with slash in name can't be called with ebook-convert)

This commit is contained in:
Kovid Goyal 2013-02-17 09:15:49 +05:30
parent d181153952
commit 82ecd7bdfa
2 changed files with 9 additions and 2 deletions

View File

@ -67,6 +67,8 @@ def check_command_line_options(parser, args, log):
('-h' in args or '--help' in args):
log.error('Cannot read from', input)
raise SystemExit(1)
if input.endswith('.recipe') and not os.access(input, os.R_OK):
input = args[1]
output = args[2]
if (output.startswith('.') and output[:2] not in {'..', '.'} and '/' not in

View File

@ -68,10 +68,15 @@ class RecipeInput(InputFormatPlugin):
recipe = compile_recipe(self.recipe_source)
log('Using custom recipe')
else:
from calibre.web.feeds.recipes.collection import \
get_builtin_recipe_by_title
from calibre.web.feeds.recipes.collection import (
get_builtin_recipe_by_title, get_builtin_recipe_titles)
title = getattr(opts, 'original_recipe_input_arg', recipe_or_file)
title = os.path.basename(title).rpartition('.')[0]
titles = frozenset(get_builtin_recipe_titles())
if title not in titles:
title = getattr(opts, 'original_recipe_input_arg', recipe_or_file)
title = title.rpartition('.')[0]
raw = get_builtin_recipe_by_title(title, log=log,
download_recipe=not opts.dont_download_recipe)
builtin = False