be nice to windows

This commit is contained in:
ed 2021-03-27 01:43:02 +01:00
parent 13e5c96cab
commit 21405c3fda
3 changed files with 9 additions and 4 deletions

View file

@ -3,7 +3,7 @@ import zlib
import struct
from datetime import datetime
from .util import yieldfile
from .util import yieldfile, sanitize_fn
def dostime2unix(buf):
@ -84,7 +84,9 @@ def gen_hdr(h_pos, fn, sz, lastmod, utf8, crc32, pre_crc):
vsz = 0xFFFFFFFF if z64 else sz
ret += struct.pack("<LL", vsz, vsz)
bfn = fn.encode("utf-8" if utf8 else "cp437", "replace")
# windows support (the "?" replace below too)
fn = sanitize_fn(fn)
bfn = fn.encode("utf-8" if utf8 else "cp437", "replace").replace(b"?", b"_")
z64_len = len(z64v) * 8 + 4 if z64v else 0
ret += struct.pack("<HH", len(bfn), z64_len)

View file

@ -147,7 +147,7 @@ var md_opt = {
</script>
<script src="/.cpr/util.js"></script>
<script src="/.cpr/deps/marked.full.js"></script>
<script src="/.cpr/deps/marked.js"></script>
<script src="/.cpr/md.js"></script>
{%- if edit %}
<script src="/.cpr/md2.js"></script>

View file

@ -237,7 +237,10 @@ function goto(dest) {
goto();
var op = sread('opmode');
if (op !== null && op !== '.')
goto(op);
try {
goto(op);
}
catch (ex) { }
})();