From nobody Fri Mar 29 05:37:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1490292748845875.7723371118838; Thu, 23 Mar 2017 11:12:28 -0700 (PDT) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 63C1E82075D; Thu, 23 Mar 2017 18:12:27 +0000 (UTC) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by lists.ovirt.org (Postfix) with ESMTPS id 2CE95820759 for ; Thu, 23 Mar 2017 18:12:18 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id r45so30483363qte.0 for ; Thu, 23 Mar 2017 11:12:18 -0700 (PDT) Received: from localhost.localdomain ([177.41.195.134]) by smtp.gmail.com with ESMTPSA id e84sm3712576qkb.49.2017.03.23.11.12.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Mar 2017 11:12:16 -0700 (PDT) X-Original-To: kimchi-devel@ovirt.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0gFvJpCfzL5Fn68D7h04rlGYjiJCF7MnTEDkXvHzXRA=; b=F6r2TMdElIpFnxzGRjK/px3UnBsPfN+Jn85EWXjIpT4hzYV0JJcaTGyFTkuEylmtB+ jt+4qdh8DvCCHhAU8r7C0TFGTGQyOzJ3Psg0JBYPij0cOa202LfvPmaopwz3lMppMF4o 4tx33VzWT9owjW1KAg6DzJm7yigVojOJx3tnJgECDBvZCLlI/2ovq6PcDYuxtioddxIU KpRhv3+JzQWbLPWHq6cvT6wwC0lH8YdEY99n2P6pNd9Z924wXFM19p0v37bU/K/XQ2cu +2mU6Kw7EIqEBmjkX4lBIhWgwY5J6wd+nGKoR3Fa0iqVqNxefXxhLUpWjkpvYKheo0n3 tqAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0gFvJpCfzL5Fn68D7h04rlGYjiJCF7MnTEDkXvHzXRA=; b=Eot26IHalViTrTeI3iTXE9XuAi76VIT7sQciU97MZ85izBJRw7lqNyay+92XWohQKK 1I8ReSZuaRglt05IcAVTszhi/5/t7v8XlOt/6jDaJI9XIzOBKhX6Cttrl7nw3Rd8mO2i sBRJQbmbuEXByY6p9BVJTxlOZvbrCpRYENBehHI/pl4np6we8KRtsTgkYpOKWqgEahnj 7lhG0h+PNgGfV+1kT4gvDK99tN5t2jt48z8DqAld/Rd9JdmqLenZa2zIamvfXaecB8CD o/AmmEJfvWlYkfoXZ1DEaBCdLBMqoTqL9Kjs4LjE3413qHko99cLxWVWXx1ShpypOnu6 jmiA== X-Gm-Message-State: AFeK/H3csAWiLvslGMY9kWQNMZoj7DROR8jQrZzEr6Som4cfo2tCEvcpgDsSzXel7LVrOA== X-Received: by 10.200.49.230 with SMTP id i35mr4111564qte.254.1490292737054; Thu, 23 Mar 2017 11:12:17 -0700 (PDT) From: To: Kimchi Devel Date: Thu, 23 Mar 2017 15:12:09 -0300 Message-Id: <20170323181209.16756-1-dhbarboza82@gmail.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Subject: [Kimchi-devel] [PATCH] [WoK] Bug fix #189: Forcing download of user log file X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Daniel Henrique Barboza The error in staticfile() happens when the browser tries to open a recently created file in a separated tab/window but this file isn't declared in the cherry-py config with tools.staticfile.on, like '/favicon.ico' for example. A suitable solution to avoid the error is to force the browser to download the file instead of opening it. According to the Cherry-py docs: "Using "application/x-download" response content-type, you can tell a browser that a resource should be downloaded onto the user=E2=80=99s machine rather than displayed." This patch set the application type of all '.txt' files created under the /data/logs dir as 'application/x-download'. Signed-off-by: Daniel Henrique Barboza --- src/wok/config.py.in | 3 +++ tests/test_config.py.in | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wok/config.py.in b/src/wok/config.py.in index 677d0ed..c2bcc28 100644 --- a/src/wok/config.py.in +++ b/src/wok/config.py.in @@ -202,6 +202,9 @@ class WokConfig(dict): '/data/logs': { 'tools.staticdir.on': True, 'tools.staticdir.dir': '%s/logs' % paths.state_dir, + 'tools.staticdir.content_types': { + 'txt': 'application/x-download' + }, 'tools.nocache.on': False, 'tools.wokauth.on': True, }, diff --git a/tests/test_config.py.in b/tests/test_config.py.in index 9b8c851..a4d65bb 100644 --- a/tests/test_config.py.in +++ b/tests/test_config.py.in @@ -1,7 +1,7 @@ # # Project Wok # -# Copyright IBM Corp, 2014-2016 +# Copyright IBM Corp, 2014-2017 # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -84,6 +84,9 @@ class ConfigTests(unittest.TestCase): '/data/logs': { 'tools.staticdir.on': True, 'tools.staticdir.dir': '%s/logs' % paths.state_dir, + 'tools.staticdir.content_types': { + 'txt': 'application/x-download' + }, 'tools.nocache.on': False, 'tools.wokauth.on': True, }, --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel