From b0746a40e7b62af8259fb20216e4cefc9c376733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Wed, 19 May 2021 12:15:45 -0700 Subject: [PATCH] Replace removed cgi.escape with html.escape. (#321) --- .github/workflows/ci.yaml | 4 ++-- rep2html.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ea6ffb35c..45b995716 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,14 +9,14 @@ on: jobs: build: name: run rep tests - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Set up Python ${{matrix.python}} uses: actions/setup-python@v1 with: - python-version: 3.6 + python-version: 3.8 - name: Install dependencies run: | python -m pip install docutils xmlschema diff --git a/rep2html.py b/rep2html.py index 327ad120d..905fb76f3 100755 --- a/rep2html.py +++ b/rep2html.py @@ -39,7 +39,7 @@ import sys import os import re -import cgi +import html import glob import getopt import errno @@ -124,8 +124,8 @@ def fixanchor(current, match): rfcnum = int(match.group('rfcnum')) link = RFCURL % rfcnum if link: - return '%s' % (cgi.escape(link), cgi.escape(text)) - return cgi.escape(match.group(0)) # really slow, but it works... + return '%s' % (html.escape(link), html.escape(text)) + return html.escape(match.group(0)) # really slow, but it works... NON_MASKED_EMAILS = [ @@ -246,18 +246,18 @@ def fixfile(inpath, input_lines, outfile): time.localtime(os.stat(inpath)[8])) try: url = REPGITURL % int(rep) - v = '%s ' % (url, cgi.escape(date)) + v = '%s ' % (url, html.escape(date)) except ValueError as error: v = date elif k.lower() in ('content-type',): url = REPURL % 9 rep_type = v or 'text/plain' - v = '%s ' % (url, cgi.escape(rep_type)) + v = '%s ' % (url, html.escape(rep_type)) else: - v = cgi.escape(v) + v = html.escape(v) print((' %s: ' + '%s') % - (cgi.escape(k), v), file=outfile) + (html.escape(k), v), file=outfile) print('', file=outfile) print('', file=outfile) print('
', file=outfile)