Allow scheme-relative URLs #1433

Closed
wants to merge 3 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+8 −0
Diff settings

Always

Just for now

View
@@ -137,3 +137,9 @@ Taylor Leese
### Email: ###
tleese22 at gmail dot com
+
+### Name: ###
+Austen Holmes
+
+### Email: ###
+austen dot holmes at gmail dot com
@@ -544,13 +544,15 @@ object Req {
private def _fixHref(contextPath: String, v: Seq[Node], fixURL: Boolean, rewrite: Box[String => String]): Text = {
val hv = v.text
val updated = if (hv.startsWith("/") &&
+ !hv.startsWith("//") &&

This comment has been minimized.

@serveace

serveace Apr 16, 2013

Contributor

From what I can tell, it looks like it's necessary to run this check in both places.

@serveace

serveace Apr 16, 2013

Contributor

From what I can tell, it looks like it's necessary to run this check in both places.

!LiftRules.excludePathFromContextPathRewriting.vend(hv)) contextPath + hv else hv
Text(if (fixURL && rewrite.isDefined &&
!updated.startsWith("mailto:") &&
!updated.startsWith("javascript:") &&
!updated.startsWith("http://") &&
!updated.startsWith("https://") &&
+ !updated.startsWith("//") &&
!updated.startsWith("#"))
rewrite.openOrThrowException("legacy code").apply(updated) else updated)
}