This is an automated email from the ASF dual-hosted git repository.
wuzhiguo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bigtop-manager.git
The following commit(s) were added to refs/heads/main by this push:
new 0f3add6 BIGTOP-4252: Fix Incorrect File Name retrieved when Tarball
downloading (#89)
0f3add6 is described below
commit 0f3add614549ced1827509296b37ccecc1fc2dc1
Author: fuxiaofengfu <[email protected]>
AuthorDate: Sun Oct 20 18:06:58 2024 +0800
BIGTOP-4252: Fix Incorrect File Name retrieved when Tarball downloading
(#89)
---
.../manager/stack/core/tarball/TarballDownloader.java | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/tarball/TarballDownloader.java
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/tarball/TarballDownloader.java
index ace5bae..1882791 100644
---
a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/tarball/TarballDownloader.java
+++
b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/tarball/TarballDownloader.java
@@ -38,18 +38,7 @@ public class TarballDownloader {
int responseCode = httpConn.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
- String fileName = "";
- String disposition =
httpConn.getHeaderField("Content-Disposition");
-
- if (disposition != null) {
- int index = disposition.indexOf("filename=");
- if (index > 0) {
- fileName = disposition.substring(index + 10,
disposition.length() - 1);
- }
- } else {
- fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
- }
-
+ String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") +
1);
InputStream inputStream = httpConn.getInputStream();
String saveFilePath = saveDir + File.separator + fileName;