Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1ED65200CAE for ; Wed, 21 Jun 2017 14:55:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1D060160BE2; Wed, 21 Jun 2017 12:55:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 63219160BD0 for ; Wed, 21 Jun 2017 14:55:10 +0200 (CEST) Received: (qmail 75118 invoked by uid 500); 21 Jun 2017 12:55:09 -0000 Mailing-List: contact dev-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list dev@sling.apache.org Received: (qmail 75107 invoked by uid 99); 21 Jun 2017 12:55:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jun 2017 12:55:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 21CDA1AF944 for ; Wed, 21 Jun 2017 12:55:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id lBl83cN0zvsT for ; Wed, 21 Jun 2017 12:55:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 2AC675FC3D for ; Wed, 21 Jun 2017 12:55:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5D131E099E for ; Wed, 21 Jun 2017 12:55:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 19AC221941 for ; Wed, 21 Jun 2017 12:55:00 +0000 (UTC) Date: Wed, 21 Jun 2017 12:55:00 +0000 (UTC) From: "Konrad Windszus (JIRA)" To: dev@sling.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SLING-6976) ContentLoader.binaryFile() and ContentLoader.binaryResource() should try to derive mimetype from classpath resource rather than from target resource name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 21 Jun 2017 12:55:11 -0000 [ https://issues.apache.org/jira/browse/SLING-6976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Konrad Windszus updated SLING-6976: ----------------------------------- Description: Currently the {{ContentLoader.binaryFile}} tries to derive the mime type from the target resource name which should contain the binary (https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java#L226). This is often useless, as the resource name almost never contains an extension from which a mimetype could be derived (very often a generic name like "file" is used). Instead the first argument (namely {{classpathResource}} should be taken as basis to derive the mime type from). Currently in practically all cases the mime type will be set to the default value (https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java#L466) which is {{application/octet-stream}}. was: Currently the {{ContentLoader.binaryFile}} tries to derive the mime type from the target property which should contain the binary (https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java#L226). This is useless, as the property name almost never contains an extension from which a mimetype could be derived. Instead the first argument (namely {{classpathResource}} should be taken as basis to derive the mime type from). Currently in practically all cases the mime type will be set to the default value (https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java#L466) which is {{application/octet-stream}}. > ContentLoader.binaryFile() and ContentLoader.binaryResource() should try to derive mimetype from classpath resource rather than from target resource name > --------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: SLING-6976 > URL: https://issues.apache.org/jira/browse/SLING-6976 > Project: Sling > Issue Type: Bug > Components: Testing > Affects Versions: Testing Sling Mock 2.2.12 > Reporter: Konrad Windszus > Attachments: SLING-6976-v01.patch > > > Currently the {{ContentLoader.binaryFile}} tries to derive the mime type from the target resource name which should contain the binary (https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java#L226). This is often useless, as the resource name almost never contains an extension from which a mimetype could be derived (very often a generic name like "file" is used). Instead the first argument (namely {{classpathResource}} should be taken as basis to derive the mime type from). > Currently in practically all cases the mime type will be set to the default value (https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java#L466) which is {{application/octet-stream}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)