mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-25 14:45:59 +03:00
Improve getAbsolutUrl method (#336)
Also fix Mangachan most popular pages
This commit is contained in:
parent
59b90a94d0
commit
dad9dcd742
1 changed files with 2 additions and 0 deletions
|
@ -415,6 +415,7 @@ abstract class OnlineSource(context: Context) : Source {
|
|||
* 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="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
|
||||
*
|
||||
* @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("/") -> url.newBuilder().encodedPath("/").fragment(null).query(null)
|
||||
.toString() + href.substring(1)
|
||||
href.startsWith("?") -> url.toString().substringBeforeLast('?') + "$href"
|
||||
else -> url.toString().substringBeforeLast('/') + "/$href"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue