Skip to content

Commit

Permalink
Fix serve (don’t bother with f.tell)
Browse files Browse the repository at this point in the history
cc @Aeyoun

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Aug 6, 2015
1 parent dc4cedd commit 29c2fae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nikola/plugins/command/serve.py
Expand Up @@ -231,15 +231,15 @@ def send_head(self):

filtered_bytes = None
if ctype == 'text/html':
"""Comment out any <base> to allow local resolution of relative URLs."""
# Comment out any <base> to allow local resolution of relative URLs.
data = f.read().decode('utf8')
f.close()
data = re.sub(r'<base\s([^>]*)>', '<!--base \g<1>-->', data, re.IGNORECASE)
data = data.encode('utf8')
f = StringIO()
f.write(data)
filtered_bytes = len(data)
f.seek(0)
filtered_bytes = f.tell()

self.send_response(200)
self.send_header("Content-type", ctype)
Expand Down

0 comments on commit 29c2fae

Please sign in to comment.