fix
This commit is contained in:
@@ -66,14 +66,15 @@ object UrlUtil {
|
|||||||
fileName.toByteArray(StandardCharsets.ISO_8859_1),
|
fileName.toByteArray(StandardCharsets.ISO_8859_1),
|
||||||
StandardCharsets.UTF_8 //?
|
StandardCharsets.UTF_8 //?
|
||||||
)
|
)
|
||||||
} else if (conn.getHeaderField("Location") != null) {
|
} else {
|
||||||
// Location跳转到实际的下载链接
|
// Location跳转到实际的下载链接
|
||||||
var newUrl: String = conn.url.path ?: return null
|
var newUrl: String = conn.url.path ?: return null
|
||||||
newUrl = URLDecoder.decode(newUrl, "UTF-8")
|
newUrl = URLDecoder.decode(newUrl, "UTF-8")
|
||||||
if (getSuffix(newUrl, "") != "") {
|
if (getSuffix(newUrl, "") != "") {
|
||||||
fileName = newUrl.substringAfterLast("/")
|
fileName = newUrl.substringAfterLast("/")
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if (fileName == "") {
|
||||||
// 其余情况 返回响应头
|
// 其余情况 返回响应头
|
||||||
val headers = conn.getHeaderFields()
|
val headers = conn.getHeaderFields()
|
||||||
val headersString = buildString {
|
val headersString = buildString {
|
||||||
@@ -86,7 +87,7 @@ object UrlUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppLog.putDebug("Cannot obtain URL file name:\n$headersString")
|
AppLog.put("Cannot obtain URL file name:\n$headersString")
|
||||||
}
|
}
|
||||||
fileName
|
fileName
|
||||||
}.getOrNull()
|
}.getOrNull()
|
||||||
|
|||||||
Reference in New Issue
Block a user