]> git.ipfire.org Git - ipfire.org.git/commitdiff
nopaste: Don't store content with the pastes any more
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 23 Feb 2024 19:41:22 +0000 (19:41 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 23 Feb 2024 19:41:22 +0000 (19:41 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/nopaste.py
src/templates/nopaste/view.html
src/web/nopaste.py

index 499aff369be7cb5c9361618666280aacdc129817..9a5088282ddb8275f3f1fdd7d2fe0c956e746b57 100644 (file)
@@ -128,13 +128,6 @@ class Nopaste(Object):
 
                return paste
 
-       def get_content(self, uuid):
-               res = self.db.get("SELECT content FROM nopaste \
-                       WHERE uuid = %s", uuid)
-
-               if res:
-                       return bytes(res.content)
-
        def cleanup(self):
                """
                        Removes all expired pastes and removes any unneeded blobs
index 13b4b73bfcaf55f8b40497f3e923c749aa0d2c0d..3ea1496c64d5abaa34ecba086b1626f32b9959ed 100644 (file)
@@ -30,9 +30,9 @@
 
        <section class="section">
                <div class="container">
-                       {% if content %}
+                       {% if entry.mimetype.startswith("text/") %}
                                <div class="block">
-                                       {% module Code(content) %}
+                                       {% module Code(entry.blob) %}
                                </div>
                        {% elif entry.mimetype.startswith("image/") %}
                                <div class="block">
index 33d50905f0f794d62acd986348c1b03ae53e7b16..04e6a8a8de35e23a1db7dc88c415aacc37a037b0 100644 (file)
@@ -102,13 +102,7 @@ class ViewHandler(base.AnalyticsMixin, base.BaseHandler):
                        # This has received a view
                        entry.viewed()
 
-               # Fetch the content if the output should be displayed
-               if entry.mimetype.startswith("text/"):
-                       content = self.backend.nopaste.get_content(entry.uuid)
-               else:
-                       content = None
-
-               self.render("nopaste/view.html", entry=entry, content=content)
+               self.render("nopaste/view.html", entry=entry)
 
 
 class CodeModule(ui_modules.UIModule):