From 8f8d0d68a35d7360ae418bdf84633b5348ee194b Mon Sep 17 00:00:00 2001 From: Paweł Jastrzębski Date: Wed, 27 Feb 2019 13:49:47 +0100 Subject: Fixed possible glob issues --- kindlecomicconverter/comic2ebook.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'kindlecomicconverter') diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 78342f9..93cf580 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -22,7 +22,7 @@ import os import sys from time import strftime, gmtime from copy import copy -from glob import glob +from glob import glob, escape from json import loads from urllib.request import Request, urlopen from re import sub @@ -37,7 +37,7 @@ from slugify import slugify as slugifyExt from PIL import Image from subprocess import STDOUT, PIPE from psutil import Popen, virtual_memory, disk_usage -from html import escape +from html import escape as hescape try: from PyQt5 import QtCore except ImportError: @@ -61,7 +61,7 @@ def main(argv=None): parser.print_help() return 0 if sys.platform.startswith('win'): - sources = set([source for arg in args for source in glob(arg)]) + sources = set([source for arg in args for source in glob(escape(arg))]) else: sources = set(args) if len(sources) == 0: @@ -112,7 +112,7 @@ def buildHTML(path, imgfile, imgfilepath): "\n", "\n", "\n", - "", escape(filename[0]), "\n", + "", hescape(filename[0]), "\n", "\n", "\n" @@ -210,7 +210,7 @@ def buildNCX(dstdir, title, chapters, chapternames): "\n", "\n", "\n", - "", escape(title), "\n", + "", hescape(title), "\n", "\n"]) for chapter in chapters: folder = chapter[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\') @@ -222,7 +222,7 @@ def buildNCX(dstdir, title, chapters, chapternames): elif os.path.basename(folder) != "Text": title = chapternames[os.path.basename(folder)] f.write("" + - escape(title) + "\n") f.write("\n") f.close() @@ -235,7 +235,7 @@ def buildNAV(dstdir, title, chapters, chapternames): "\n", "\n", "\n", - "" + escape(title) + "\n", + "" + hescape(title) + "\n", "\n", "\n", "\n", @@ -248,7 +248,7 @@ def buildNAV(dstdir, title, chapters, chapternames): title = chapternames[chapter[1]] elif os.path.basename(folder) != "Text": title = chapternames[os.path.basename(folder)] - f.write("
  • " + escape(title) + "
  • \n") + f.write("
  • " + hescape(title) + "
  • \n") f.writelines(["\n", "\n", "\n\n") f.close() @@ -669,7 +669,7 @@ def getComicInfo(path, originalpath): options.authors = [] if defaultTitle: if xml.data['Series']: - options.title = escape(xml.data['Series']) + options.title = hescape(xml.data['Series']) if xml.data['Volume']: titleSuffix += ' V' + xml.data['Volume'].zfill(2) if xml.data['Number']: @@ -677,7 +677,7 @@ def getComicInfo(path, originalpath): options.title += titleSuffix for field in ['Writers', 'Pencillers', 'Inkers', 'Colorists']: for person in xml.data[field]: - options.authors.append(escape(person)) + options.authors.append(hescape(person)) if len(options.authors) > 0: options.authors = list(set(options.authors)) options.authors.sort() @@ -688,7 +688,7 @@ def getComicInfo(path, originalpath): if xml.data['Bookmarks']: options.chapters = xml.data['Bookmarks'] if xml.data['Summary']: - options.summary = escape(xml.data['Summary']) + options.summary = hescape(xml.data['Summary']) os.remove(xmlPath) -- cgit 1.4.1