From 5ea352c988129c3f6f8fe637b34bd84ff0201b57 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Mon, 16 Jan 2006 15:13:58 +0300 Subject: [PATCH] fix problem with downloaded plugin file name --- .../src/com/intellij/ide/plugins/RepositoryHelper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins-management/src/com/intellij/ide/plugins/RepositoryHelper.java b/plugins-management/src/com/intellij/ide/plugins/RepositoryHelper.java index 6e1a9dd896..ead1567a5c 100644 --- a/plugins-management/src/com/intellij/ide/plugins/RepositoryHelper.java +++ b/plugins-management/src/com/intellij/ide/plugins/RepositoryHelper.java @@ -222,14 +222,15 @@ public class RepositoryHelper { if (contentDisposition == null) { // try to find filename in URL String usedURL = connection.getURL().toString(); - int startPos = usedURL.lastIndexOf("/"); - - fileName = usedURL.substring(startPos + 1); + final int startPos = usedURL.lastIndexOf("/"); + final int endPos = usedURL.lastIndexOf("?"); + fileName = usedURL.substring(startPos + 1, endPos < startPos? usedURL.length() : endPos); if (fileName.length() == 0) { return null; } - } else { + } + else { int startIdx = contentDisposition.indexOf(FILENAME); if (startIdx != -1) { fileName = contentDisposition.substring(startIdx + FILENAME.length(), contentDisposition.length()); -- 2.11.4.GIT