Replace any whitespace characters with spaces in query before searching (#408)

This commit is contained in:
Matt Bague 2018-08-02 18:38:08 -07:00 committed by Carlos
parent c63ef3dda2
commit 13d7072c86
1 changed files with 3 additions and 1 deletions

View File

@ -40,6 +40,8 @@ open class Mangadex(override val lang: String, private val internalLang: String,
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
}
private val whitespaceRegex = "\\s".toRegex()
private fun clientBuilder(): OkHttpClient = clientBuilder(getShowR18())
@ -162,7 +164,7 @@ open class Mangadex(override val lang: String, private val internalLang: String,
}
}
//do traditional search
val url = HttpUrl.parse("$baseUrl/?page=search")!!.newBuilder().addQueryParameter("p", page.toString()).addQueryParameter("title", query)
val url = HttpUrl.parse("$baseUrl/?page=search")!!.newBuilder().addQueryParameter("p", page.toString()).addQueryParameter("title", query.replace(whitespaceRegex, " "))
filters.forEach { filter ->
when (filter) {
is TextField -> url.addQueryParameter(filter.key, filter.state)