mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-12 05:59:33 +00:00
Render baseurl without trailing slash
The webapp expects it like this currently, because the url is only a string.
This commit is contained in:
parent
b9b554980a
commit
0ec620fcf0
@ -49,6 +49,12 @@ case class LenientUri(
|
|||||||
def withFragment(f: String): LenientUri =
|
def withFragment(f: String): LenientUri =
|
||||||
copy(fragment = Some(f))
|
copy(fragment = Some(f))
|
||||||
|
|
||||||
|
def rootPathToEmpty: LenientUri =
|
||||||
|
path match {
|
||||||
|
case LenientUri.RootPath => copy(path = LenientUri.EmptyPath)
|
||||||
|
case _ => this
|
||||||
|
}
|
||||||
|
|
||||||
def toJavaUrl: Either[String, URL] =
|
def toJavaUrl: Either[String, URL] =
|
||||||
Either.catchNonFatal(new URL(asString)).left.map(_.getMessage)
|
Either.catchNonFatal(new URL(asString)).left.map(_.getMessage)
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ object Flags {
|
|||||||
)
|
)
|
||||||
|
|
||||||
private def getBaseUrl(cfg: Config): String =
|
private def getBaseUrl(cfg: Config): String =
|
||||||
if (cfg.baseUrl.isLocal) cfg.baseUrl.path.asString
|
if (cfg.baseUrl.isLocal) cfg.baseUrl.rootPathToEmpty.path.asString
|
||||||
else cfg.baseUrl.asString
|
else cfg.baseUrl.rootPathToEmpty.asString
|
||||||
|
|
||||||
implicit val jsonEncoder: Encoder[Flags] =
|
implicit val jsonEncoder: Encoder[Flags] =
|
||||||
deriveEncoder[Flags]
|
deriveEncoder[Flags]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user