Merge pull request #583 from eikek/fix-baseurl-setting

Render baseurl without trailing slash
This commit is contained in:
mergify[bot] 2021-01-21 23:44:14 +00:00 committed by GitHub
commit 8dd1672c8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -49,6 +49,12 @@ case class LenientUri(
def withFragment(f: String): LenientUri =
copy(fragment = Some(f))
def rootPathToEmpty: LenientUri =
path match {
case LenientUri.RootPath => copy(path = LenientUri.EmptyPath)
case _ => this
}
def toJavaUrl: Either[String, URL] =
Either.catchNonFatal(new URL(asString)).left.map(_.getMessage)

View File

@ -36,8 +36,8 @@ object Flags {
)
private def getBaseUrl(cfg: Config): String =
if (cfg.baseUrl.isLocal) cfg.baseUrl.path.asString
else cfg.baseUrl.asString
if (cfg.baseUrl.isLocal) cfg.baseUrl.rootPathToEmpty.path.asString
else cfg.baseUrl.rootPathToEmpty.asString
implicit val jsonEncoder: Encoder[Flags] =
deriveEncoder[Flags]