From 1f97171b89a98e02f63e6938d7f1959dd26cd5b5 Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Wed, 8 Aug 2012 22:27:50 +1000 Subject: [PATCH] [PATCH v2 1/3] test: normalize only message filenames in show json --- fe/4df274864c253d2262b94f5e35229a9ea2553f | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 fe/4df274864c253d2262b94f5e35229a9ea2553f diff --git a/fe/4df274864c253d2262b94f5e35229a9ea2553f b/fe/4df274864c253d2262b94f5e35229a9ea2553f new file mode 100644 index 000000000..7b53316ef --- /dev/null +++ b/fe/4df274864c253d2262b94f5e35229a9ea2553f @@ -0,0 +1,100 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id ABE57431FCB + for ; Wed, 8 Aug 2012 05:28:21 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id cjBUrWG22mEt for ; + Wed, 8 Aug 2012 05:28:20 -0700 (PDT) +Received: from mail-gh0-f181.google.com (mail-gh0-f181.google.com + [209.85.160.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B3366431FBD + for ; Wed, 8 Aug 2012 05:28:17 -0700 (PDT) +Received: by mail-gh0-f181.google.com with SMTP id 3so879463ghz.26 + for ; Wed, 08 Aug 2012 05:28:17 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=A1SeD3Pd8IBIIpeIsFB/+bIfXsSVY2O/PLTAjB3GYCw=; + b=zBBDamLj9IhGiUKHYDv3hDcgF9S46DLeeEGcy1oOep/X1K2Qp9Wo6DaA9cyBRUTqQW + VPO0mkXHUNyLQjUE/Tsp+tN3ZHnKsG67MkbI8qzdak4JL3ZPUrvPUlelGK3kPIWqxDA3 + IhfZ5IJIFpAbE++FQFhVKp9s7/GBReAcJAjyDRdaftnwESDv1/7kDc96ZrUmm/PTabWu + WbyDTq8xAmSv/3sBpPRsaLvaH6SEL6rH8hQr44H+avGyoYWur5hbDcHEO8bC5b6dwXm/ + s5mFYkrNxhbf8tiVAEs1PvC8i+5zLvcE+i0vyYGpIQPQudKRkSkpvqHxEKxXOUTrRU86 + L90g== +Received: by 10.66.88.39 with SMTP id bd7mr33513018pab.50.1344428897304; + Wed, 08 Aug 2012 05:28:17 -0700 (PDT) +Received: from localhost (215.42.233.220.static.exetel.com.au. + [220.233.42.215]) + by mx.google.com with ESMTPS id qx8sm9893074pbc.63.2012.08.08.05.28.14 + (version=TLSv1/SSLv3 cipher=OTHER); + Wed, 08 Aug 2012 05:28:16 -0700 (PDT) +From: Peter Wang +To: notmuch@notmuchmail.org +Subject: [PATCH v2 1/3] test: normalize only message filenames in show json +Date: Wed, 8 Aug 2012 22:27:50 +1000 +Message-Id: <1344428872-12374-2-git-send-email-novalazy@gmail.com> +X-Mailer: git-send-email 1.7.4.4 +In-Reply-To: <1344428872-12374-1-git-send-email-novalazy@gmail.com> +References: <1344428872-12374-1-git-send-email-novalazy@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 08 Aug 2012 12:28:22 -0000 + +notmuch_json_show_sanitize replaced "filename" field values even in part +structures, where the value is predictable. Make it only normalize the +filename value if it is an absolute path (begins with slash), which is +true of the Maildir filenames that were intended to be normalized away. +--- + test/multipart | 2 +- + test/test-lib.sh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/multipart b/test/multipart +index 0527f84..344ed81 100755 +--- a/test/multipart ++++ b/test/multipart +@@ -630,7 +630,7 @@ cat <EXPECTED + "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, + {"id": 7, + "content-type": "text/plain", +- "filename": "YYYYY", ++ "filename": "attachment", + "content": "This is a text attachment.\n"}, + {"id": 8, + "content-type": "text/plain", +diff --git a/test/test-lib.sh b/test/test-lib.sh +index 791d2dc..983694e 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -577,7 +577,7 @@ notmuch_json_show_sanitize () + { + sed \ + -e 's|"id": "[^"]*",|"id": "XXXXX",|g' \ +- -e 's|"filename": "[^"]*",|"filename": "YYYYY",|g' ++ -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g' + } + + # End of notmuch helper functions +-- +1.7.4.4 + -- 2.26.2