wepub

Check-in [7efc426083]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Correctly dequote path names. Make text readable.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:7efc4260830db892ac8e8761243b3d9a6f9ae2c8a35f60360ca63140a392acf7
User & Date: ajv-899-334-8894@vsta.org 2016-11-17 17:29:39
Context
2016-11-17
17:30
Return to previous position check-in: 903e492aa3 user: ajv-899-334-8894@vsta.org tags: master, trunk
17:29
Correctly dequote path names. Make text readable. check-in: 7efc426083 user: ajv-899-334-8894@vsta.org tags: master, trunk
17:29
Convert to account server. Firewall friendly port numbering. check-in: fac2f64eea user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to get.py.

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

        # We have the "cfg" for this prefix, point at the
        #  root of those files
        path = cfg["path"]
        rest = self.path.replace(f, '', 1)

        # Deflect nonsense
        parts = [p for p in os.path.split(rest) if p]
        if any((f == "..") for f in parts):
            return False,None

        # Is this an active book?
        # /prefix/...path.../<book>/<chap#>
        if (len(parts) > 1) and parts[-2].endswith(".epub"):
            try:
................................................................................

            # Here's your chapter
            nm = book.titles[0] if book.titles else parts[-2]
            head = "%s chapter %d" % (nm, chapnum)
            buf = self.build_header(head)
            buf += '<script src="/js/reader.js"></script>\n'
            buf += '<div id="textview"\n'
            buf += '  style="width: 100%;">\n'
            buf += chap.read()
            buf += '</div>\n'
            doc.close()
            buf += '<script>reading("%s", "%s", "%s");</script>\n' % \
                (self.user, docpath, "textview")
            buf = self.build_tailer(buf)








|







 







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

        # We have the "cfg" for this prefix, point at the
        #  root of those files
        path = cfg["path"]
        rest = self.path.replace(f, '', 1)

        # Deflect nonsense
        parts = [urllib.unquote(p) for p in os.path.split(rest) if p]
        if any((f == "..") for f in parts):
            return False,None

        # Is this an active book?
        # /prefix/...path.../<book>/<chap#>
        if (len(parts) > 1) and parts[-2].endswith(".epub"):
            try:
................................................................................

            # Here's your chapter
            nm = book.titles[0] if book.titles else parts[-2]
            head = "%s chapter %d" % (nm, chapnum)
            buf = self.build_header(head)
            buf += '<script src="/js/reader.js"></script>\n'
            buf += '<div id="textview"\n'
            buf += '  style="color: white; background: black; width: 100%;">\n'
            buf += chap.read()
            buf += '</div>\n'
            doc.close()
            buf += '<script>reading("%s", "%s", "%s");</script>\n' % \
                (self.user, docpath, "textview")
            buf = self.build_tailer(buf)