Show a patch.

GET /api/patches/9963/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 9963,
    "url": "https://patchwork.libcamera.org/api/patches/9963/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9963/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20201005131137.50124-1-email@uajain.com>",
    "date": "2020-10-05T13:11:37",
    "name": "[libcamera-devel] android: jpeg: exif: Sanitize ASCII strings with utils::toAscii()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "2284c0dc0d3bbbc7ae01b718f7563a0d7b9e9d51",
    "submitter": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/people/1/?format=api",
        "name": "Umang Jain",
        "email": "email@uajain.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/9963/mbox/",
    "series": [
        {
            "id": 1350,
            "url": "https://patchwork.libcamera.org/api/series/1350/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1350",
            "date": "2020-10-05T13:11:37",
            "name": "[libcamera-devel] android: jpeg: exif: Sanitize ASCII strings with utils::toAscii()",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1350/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9963/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9963/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3AA14C3B5D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Oct 2020 13:11:48 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BC77563BED;\n\tMon,  5 Oct 2020 15:11:47 +0200 (CEST)",
            "from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 670EF63BD5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Oct 2020 15:11:45 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"tN2iYHAx\"; dkim-atps=neutral",
        "From": "Umang Jain <email@uajain.com>",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1601903504; bh=azo16TZcaq8xR0sVR2t+K45QyiikEXctw+ArawBm+bQ=;\n\th=From:To:Cc:Subject;\n\tb=tN2iYHAxxMv+ylAu6IGrQpiM8BN198tat1ZDMNzcSMr7rnGvFc5dzWNLI96dReyZ4\n\th4jX6v4hM5OZwojOXaJ4zlYUjpIY2vyTZzcYteW5G2Lxp3SVyc3NEPGn9CaDJNA8OS\n\tw5YHn8u2Rsjyesu3c1D+4zxhaH1RykXlbxnVKhiRgg5DeKZQCnWTd12Ni2n9OwDxmX\n\tG/KILnFvB3P3SgXWQ8DeorPvsA/C3ZQlIG0N0kbU97jAVFnEPGtR7V6a3yGN6cVcWY\n\ttcNIMZSv5bpXC1p0E9XCrkR+YAayPolHEMnYboBFhkzJnelayVTz4KAkX9t5DDRJ7l\n\tZsVYilrtYHPTQ==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  5 Oct 2020 18:41:37 +0530",
        "Message-Id": "<20201005131137.50124-1-email@uajain.com>",
        "Mime-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] android: jpeg: exif: Sanitize ASCII\n\tstrings with utils::toAscii()",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Use the newly introduced utils::toAscii() utility to remove all\nnon-ASCII characters for EXIF_FORMAT_ASCII strings.\n\nSigned-off-by: Umang Jain <email@uajain.com>\n---\n src/android/jpeg/exif.cpp | 13 +++++++++----\n 1 file changed, 9 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp\nindex 3fd5d55..bd528a7 100644\n--- a/src/android/jpeg/exif.cpp\n+++ b/src/android/jpeg/exif.cpp\n@@ -8,6 +8,7 @@\n #include \"exif.h\"\n \n #include \"libcamera/internal/log.h\"\n+#include \"libcamera/internal/utils.h\"\n \n using namespace libcamera;\n \n@@ -171,15 +172,19 @@ void Exif::setRational(ExifIfd ifd, ExifTag tag, ExifRational item)\n \n void Exif::setString(ExifIfd ifd, ExifTag tag, ExifFormat format, const std::string &item)\n {\n-\t/* Pad 1 extra byte for null-terminated string in ASCII format. */\n-\tsize_t length = format == EXIF_FORMAT_ASCII ?\n-\t\t\titem.length() + 1 : item.length();\n+\tsize_t length = item.length();\n+\tstd::string str = item;\n+\tif (format == EXIF_FORMAT_ASCII) {\n+\t\tstr = utils::toAscii(str);\n+\t\t/* Pad 1 extra byte to null-terminate the ASCII string. */\n+\t\tlength += 1;\n+\t}\n \n \tExifEntry *entry = createEntry(ifd, tag, format, length, length);\n \tif (!entry)\n \t\treturn;\n \n-\tmemcpy(entry->data, item.c_str(), length);\n+\tmemcpy(entry->data, str.c_str(), length);\n \texif_entry_unref(entry);\n }\n \n",
    "prefixes": [
        "libcamera-devel"
    ]
}