From 93de90c9c9185973b9bdd7b971faa39a8414be24 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 1 Feb 2022 23:13:47 -0800 Subject: [PATCH] strip cr in paste body --- Dockerfile | 12 +++++----- requirements.txt | 56 +++++++++++++++++++++------------------------- wastebin/daemon.py | 2 +- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9dea130..db0c346 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:bionic +FROM ubuntu:focal RUN sed -i -E 's/(archive|security).ubuntu.com/192.168.1.142/' /etc/apt/sources.list && \ sed -i -E 's/^deb-src/# deb-src/' /etc/apt/sources.list && \ @@ -6,11 +6,11 @@ RUN sed -i -E 's/(archive|security).ubuntu.com/192.168.1.142/' /etc/apt/sources. DEBIAN_FRONTEND=noninteractive \ apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \ wget gpg git build-essential && \ - wget -qO- http://artifact.scc.net.davepedu.com/repo/apt/extpython/dists/bionic/install | bash /dev/stdin && \ + wget -qO- http://artifact.scc.net.davepedu.com/repo/apt/extpython/dists/focal/install | bash /dev/stdin && \ apt-get update && \ DEBIAN_FRONTEND=noninteractive \ apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \ - extpython-python3.7 && \ + extpython-python3.9 && \ apt-get clean autoclean && \ apt-get autoremove -y && \ rm -rf /var/lib/{apt,dpkg,cache,log}/ @@ -18,9 +18,9 @@ RUN sed -i -E 's/(archive|security).ubuntu.com/192.168.1.142/' /etc/apt/sources. ADD . /tmp/code RUN cd /tmp/code && \ - /opt/extpython/3.7/bin/pip3 install -r requirements.txt && \ - /opt/extpython/3.7/bin/python3 setup.py install && \ + /opt/extpython/3.9/bin/pip3 install -r requirements.txt && \ + /opt/extpython/3.9/bin/python3 setup.py install && \ useradd --uid 1000 app USER app -ENTRYPOINT ["/opt/extpython/3.7/bin/wastebind"] +ENTRYPOINT ["/opt/extpython/3.9/bin/wastebind"] diff --git a/requirements.txt b/requirements.txt index 8c4e8a7..903f95f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,32 +1,28 @@ -appdirs==1.4.3 -asn1crypto==0.24.0 -backports.functools-lru-cache==1.5 -BTrees==4.5.1 -certifi==2019.3.9 -cffi==1.12.3 -chardet==3.0.4 -cheroot==6.5.5 -CherryPy==18.1.1 -cryptography==2.7 -idna==2.8 -jaraco.functools==2.0 -more-itertools==7.0.0 -perfmetrics==2.0 -persistent==4.5.0 -portend==2.4 -pycparser==2.19 -PyMySQL==0.9.3 -pytz==2019.1 +appdirs==1.4.4 +BTrees==4.9.2 +cffi==1.15.0 +cheroot==8.6.0 +CherryPy==18.6.1 +jaraco.classes==3.2.1 +jaraco.collections==3.5.1 +jaraco.context==4.1.1 +jaraco.functools==3.5.0 +jaraco.text==3.7.0 +more-itertools==8.12.0 +perfmetrics==3.2.0.post0 +persistent==4.7.0 +portend==3.1.0 +pycparser==2.21 +PyMySQL==1.0.2 +pytz==2021.3 -e git+https://git.davepedu.com/dave/relstorage.git@5ae138b71a0eeb740208e61cfd1662c49738ee45#egg=RelStorage -requests==2.22.0 -six==1.12.0 -tempora==1.14.1 -transaction==2.4.0 -urllib3==1.25.3 -zc.lockfile==1.4 -ZConfig==3.4.0 +six==1.16.0 +tempora==5.0.1 +transaction==3.0.1 +zc.lockfile==2.0 +ZConfig==3.6.0 zdaemon==4.3 -ZEO==5.2.1 -ZODB==5.5.1 -zodbpickle==1.0.3 -zope.interface==4.6.0 +ZEO==5.2.3 +ZODB==5.6.0 +zodbpickle==2.2.0 +zope.interface==5.4.0 diff --git a/wastebin/daemon.py b/wastebin/daemon.py index 6877ce1..42f7878 100644 --- a/wastebin/daemon.py +++ b/wastebin/daemon.py @@ -119,7 +119,7 @@ class WasteWeb(object): def make(self, name, contents): if not RE_NAME.match(name): raise cherrypy.HTTPError(400, f"paste name must match {RE_NAME_RAW}") - self.db.writepaste(name, contents) + self.db.writepaste(name, contents.replace("\r", "")) raise cherrypy.HTTPRedirect("/" + name) @cherrypy.expose