浏览代码

Improve getAbsolutUrl method (#336)

Also fix Mangachan most popular pages
Taumer 8 年之前
父节点
当前提交
dad9dcd742
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      app/src/main/java/eu/kanade/tachiyomi/data/source/online/OnlineSource.kt

+ 2 - 0
app/src/main/java/eu/kanade/tachiyomi/data/source/online/OnlineSource.kt

@@ -415,6 +415,7 @@ abstract class OnlineSource(context: Context) : Source {
      * href="http://example.com/foo" url="http://example.com" -> http://example.com/foo
      * href="http://example.com/foo" url="http://example.com" -> http://example.com/foo
      * href="/mypath" url="http://example.com/foo" -> http://example.com/mypath
      * href="/mypath" url="http://example.com/foo" -> http://example.com/mypath
      * href="bar" url="http://example.com/foo" -> http://example.com/bar
      * href="bar" url="http://example.com/foo" -> http://example.com/bar
+     * href="?bar" url="http://example.com/foo" -> http://example.com/foo?bar
      * href="bar" url="http://example.com/foo/" -> http://example.com/foo/bar
      * href="bar" url="http://example.com/foo/" -> http://example.com/foo/bar
      *
      *
      * @param href the href attribute from the html.
      * @param href the href attribute from the html.
@@ -424,6 +425,7 @@ abstract class OnlineSource(context: Context) : Source {
         href.startsWith("http://") || href.startsWith("https://") -> href
         href.startsWith("http://") || href.startsWith("https://") -> href
         href.startsWith("/") -> url.newBuilder().encodedPath("/").fragment(null).query(null)
         href.startsWith("/") -> url.newBuilder().encodedPath("/").fragment(null).query(null)
                 .toString() + href.substring(1)
                 .toString() + href.substring(1)
+        href.startsWith("?") -> url.toString().substringBeforeLast('?') + "$href"
         else -> url.toString().substringBeforeLast('/') + "/$href"
         else -> url.toString().substringBeforeLast('/') + "/$href"
     }
     }