From issues-return-66219-archive-asf-public=cust-asf.ponee.io@commons.apache.org Wed Jan 31 08:13:08 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 8D97A18066D for ; Wed, 31 Jan 2018 08:13:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7DC21160C25; Wed, 31 Jan 2018 07:13:08 +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 CE701160C35 for ; Wed, 31 Jan 2018 08:13:07 +0100 (CET) Received: (qmail 68136 invoked by uid 500); 31 Jan 2018 07:13:04 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 68085 invoked by uid 99); 31 Jan 2018 07:13:04 -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, 31 Jan 2018 07:13:04 +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 ACAE71A4D8E for ; Wed, 31 Jan 2018 06:59:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -102.311 X-Spam-Level: X-Spam-Status: No, score=-102.311 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, 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 43bSkmHxDiNN for ; Wed, 31 Jan 2018 06:59:02 +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 07CFB60EA9 for ; Wed, 31 Jan 2018 06:59:02 +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 ED991E01DC for ; Wed, 31 Jan 2018 06:59: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 222AB240FA for ; Wed, 31 Jan 2018 06:59:00 +0000 (UTC) Date: Wed, 31 Jan 2018 06:59:00 +0000 (UTC) From: "Jochen Wiedmann (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (IO-567) FilenameUtils is unaware of NTFS alternate data streams MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/IO-567?page=3Dcom.atlassian.jir= a.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16346342= #comment-16346342 ]=20 Jochen Wiedmann commented on IO-567: ------------------------------------ =C2=A0 >=C2=A0it should be sanitised by the caller before use. Which is, why we are throwing an Exception: So, that the caller knows. =C2=A0 > FilenameUtils is unaware of NTFS alternate data streams > ------------------------------------------------------- > > Key: IO-567 > URL: https://issues.apache.org/jira/browse/IO-567 > Project: Commons IO > Issue Type: Bug > Reporter: Jochen Wiedmann > Assignee: Jochen Wiedmann > Priority: Minor > > Windows NTFS has a feature, called ADS (Alternate Data Streams). Basicall= y, it works like this: Traditionally, a file called "foo" consists of a byt= e stream, which can be read,if we open the file "foo". Not so with NTFS. A = file may have other byte streams, the so-called alternate data streams. The= se are addressed by using file names like "foo:alternate_stream_name". (Col= on as a separator.) > =C2=A0 > While that is not a problem in itself, it may become difficult in connect= ion with file name extensions. As you know, these have a special meaning on= Windows. A .exe file may be executed. Thus, a .exe file with unknown conte= nts would be dangerous. In the case of NTFS, this must be rephrased: A .exe= file with unknown contents in its default data stream would be dangerous. > =C2=A0 > Now consider the case of a name like "foo.exe:bar.txt". This would be the= alternate data stream named "bar.txt" in a file, named "foo.exe". If that = name is passed to FilenameUtils.getExtension(String), it would happily retu= rn ".txt", although the Windows Explorer, or whatever other tool would show= us "foo.exe". > =C2=A0 > Commons IO should implement special case handling for this in FilenameUti= ls.getExtension(String), and FilenameUtils.indexOfExtension(String) > =C2=A0 > Suggestion: > =C2=A0 > =C2=A0 =C2=A0 a) Document the problem in Javadoc, and > =C2=A0 =C2=A0 b) Throw an IllegalArgumentException, if the file name cont= ains a ':'. > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)