From a64bab36ac38356b09b0c62293672b3ea16693b6 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Fri, 17 Mar 2023 09:48:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/book/import/BaseImportBookActivity.kt | 2 +- .../main/java/io/legado/app/utils/UrlUtil.kt | 41 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt index 6e31646a1..06fddad74 100644 --- a/app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/import/BaseImportBookActivity.kt @@ -93,7 +93,7 @@ abstract class BaseImportBookActivity : VMBaseActivity + value.forEach { + append(key) + append(": ") + append(it) + append("\n") + } + } + } + } + // val fileSize = conn.getContentLengthLong() / 1024 - /** Content-Disposition 存在三种情况 + /** Content-Disposition 存在三种情况 文件名应该用引号 有些用空格 * filename="filename" - * filename=filename - * filename*=charset''filename + * filename*="charset''filename" */ val raw: String? = conn.getHeaderField("Content-Disposition") // Location跳转到实际链接 @@ -90,13 +105,13 @@ object UrlUtil { val names = hashSetOf() fileNames.forEach { var fileName = it.substringAfter("=") + .trim() + .replace("^\"".toRegex(), "") + .replace("\"$".toRegex(), "") if (it.contains("filename*")) { val data = fileName.split("''") names.add(URLDecoder.decode(data[1], data[0])) } else { - fileName = fileName - .replace("^\"".toRegex(), "") - .replace("\"$".toRegex(), "") names.add( String( fileName.toByteArray(StandardCharsets.ISO_8859_1), @@ -110,19 +125,7 @@ object UrlUtil { val newUrl= URL(URLDecoder.decode(redirectUrl, "UTF-8")) getFileNameFromPath(newUrl) } else { - // 其余情况 返回响应头 - val headers = conn.headerFields - val headersString = buildString { - headers.forEach { (key, value) -> - value.forEach { - append(key) - append(": ") - append(it) - append("\n") - } - } - } - AppLog.put("Cannot obtain URL file name:\n$headersString") + AppLog.put("Cannot obtain URL file name, enable recordLog fo rdetail") null } } From ac4b1e3bb1b47490ff897bebecb386eead07e80d Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Fri, 17 Mar 2023 09:53:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/utils/UrlUtil.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/utils/UrlUtil.kt b/app/src/main/java/io/legado/app/utils/UrlUtil.kt index 346f669b8..b8bb9e233 100644 --- a/app/src/main/java/io/legado/app/utils/UrlUtil.kt +++ b/app/src/main/java/io/legado/app/utils/UrlUtil.kt @@ -89,6 +89,7 @@ object UrlUtil { } } } + AppLog.put("${url.toString()} response header:\n$headersString") } // val fileSize = conn.getContentLengthLong() / 1024 @@ -125,7 +126,7 @@ object UrlUtil { val newUrl= URL(URLDecoder.decode(redirectUrl, "UTF-8")) getFileNameFromPath(newUrl) } else { - AppLog.put("Cannot obtain URL file name, enable recordLog fo rdetail") + AppLog.put("Cannot obtain URL file name, enable recordLog for detail") null } } From c441c53e2c83997f7370866f1249b462f4298045 Mon Sep 17 00:00:00 2001 From: Xwite <82232510+Xwite@users.noreply.github.com> Date: Fri, 17 Mar 2023 10:13:06 +0800 Subject: [PATCH 3/3] Update stale.yml --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index ff905039f..74dd0bce6 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: stale: runs-on: ubuntu-latest - if: ${{ github.actor == 'gedoor' }} + if: ${{ github.repository == 'gedoor/legado' }} permissions: issues: write