Skip to content
Browse files

Delimit version in GUID string by a dash.

Before we were relying on the expected length of the funcName,
determined by calling nextFuncName. Because funcName isn't *always* the
same length, we switch instead ot putting a - between the GUID and the
version identifier in the path. We then look for it when extracting the
version identifier.
  • Loading branch information...
1 parent ba0b313 commit 1c465306bd2049bcdeb8b81fce5c1fda5e774c95 @Shadowfiend Shadowfiend committed
View
8 web/webkit/src/main/scala/net/liftweb/http/LiftServlet.scala
@@ -418,11 +418,11 @@ class LiftServlet extends Loggable {
private object AjaxVersions {
def unapply(ajaxPathPart: String) : Option[(String,Int)] = {
- val funcLength = Helpers.nextFuncName.length
- if (ajaxPathPart.length > funcLength)
+ val dash = ajaxPathPart.indexOf("-")
+ if (dash > -1 && ajaxPathPart.length > dash + 1)
Some(
- (ajaxPathPart.substring(0, funcLength),
- ajaxPathPart.charAt(funcLength))
+ (ajaxPathPart.substring(0, dash),
+ ajaxPathPart.charAt(dash + 1))
)
else
None
View
2 web/webkit/src/main/scala/net/liftweb/http/js/ScriptRenderer.scala
@@ -186,7 +186,7 @@ object ScriptRenderer {
addPageNameAndVersion: function(url) {
return """ + {
if (LiftRules.enableLiftGC) {
- "url.replace('" + LiftRules.ajaxPath + "', '" + LiftRules.ajaxPath + "/'+lift_page+(liftAjax.lift_ajaxVersion % 36).toString(36));"
+ "url.replace('" + LiftRules.ajaxPath + "', '" + LiftRules.ajaxPath + "/'+lift_page+('-'+liftAjax.lift_ajaxVersion%36).toString(36));"
} else {
"url;"
}

2 comments on commit 1c46530

@fmpwizard
Lift Web Framework member

I was going to ask about how safe it was to use val funcLength = Helpers.nextFuncName.length , glad you went the path of being explicit about the two values.

@Shadowfiend
Lift Web Framework member

Yeah, it was a bit of a hack at first to get things going while I figured out a better way of dealing with it :)

Please sign in to comment.
Something went wrong with that request. Please try again.