Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1ED6D18387 for ; Tue, 16 Feb 2016 17:27:19 +0000 (UTC) Received: (qmail 28434 invoked by uid 500); 16 Feb 2016 17:27:18 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 28325 invoked by uid 500); 16 Feb 2016 17:27:18 -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 28089 invoked by uid 99); 16 Feb 2016 17:27:18 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Feb 2016 17:27:18 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 440502C1F68 for ; Tue, 16 Feb 2016 17:27:18 +0000 (UTC) Date: Tue, 16 Feb 2016 17:27:18 +0000 (UTC) From: "Federico Bonelli (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (IO-499) FilenameUtils.directoryContains(String, String) gives false positive when two directories exist with equal prefixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Federico Bonelli created IO-499: ----------------------------------- Summary: FilenameUtils.directoryContains(String, String) gives false positive when two directories exist with equal prefixes Key: IO-499 URL: https://issues.apache.org/jira/browse/IO-499 Project: Commons IO Issue Type: Bug Affects Versions: 2.4 Reporter: Federico Bonelli Priority: Minor In a folder layout as such: {code} /foo/a.txt /foo2/b.txt {code} The result of invoking directoryContains is wrong: {code} FilenameUtils.directoryContains("/foo", "/foo2/b.txt"); // returns true {code} even if "/foo" and "/foo2/b.txt" are the canonical paths, they start with the same characters, and the current implementation of the method fails. As workaround we are currently appending a path separator '/' to the first argument. It is noteworthy that the current implementation of FileUtils.directoryContains() reveals this issue because it uses the File.getCanonicalPath() to obtain the String paths of "/foo" and "/foo2/b.txt". -- This message was sent by Atlassian JIRA (v6.3.4#6332)