From cde9d8864c008b3f12622217d50613771886b1b9 Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Mon, 26 Jan 2009 12:10:16 -0500 Subject: [PATCH] Fix #1700. Handle LIT files with URL-encoded filenames in their manifests. --- src/calibre/ebooks/lit/reader.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index 461c067382..02fc98d9df 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -11,6 +11,7 @@ import sys, struct, cStringIO, os import functools import re from urlparse import urldefrag +from urllib import unquote as urlunquote from lxml import etree from calibre.ebooks.lit import LitError from calibre.ebooks.lit.maps import OPF_MAP, HTML_MAP @@ -611,6 +612,8 @@ class LitReader(object): offset, raw = u32(raw), raw[4:] internal, raw = consume_sized_utf8_string(raw) original, raw = consume_sized_utf8_string(raw) + # The path should be stored unquoted, but not always + original = urlunquote(original) # Is this last one UTF-8 or ASCIIZ? mime_type, raw = consume_sized_utf8_string(raw, zpad=True) self.manifest[internal] = ManifestItem(