diff --git a/Tag.cpp b/Tag.cpp index 9424198..e0ca433 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -471,16 +471,13 @@ namespace jet { throw coreutils::Exception("session variable requested but no session is active (missing sessiondir keyword, or cgi mode is off)."); coreutils::MString sessionValue = (*global.sessionFile)[name]; return processModifier(sessionValue, modifier); - } else if(variable.ifNext("%")) { - // NOTE: unreachable - '%' is already claimed by the keyword-lookup branch - // above (variable.ifNext("%") at the top of this chain), so this branch - // can never be entered. This looks like a copy-paste where the intended - // sigil character for environment-variable access was meant to be - // something else. Left as-is rather than guessing a new template-syntax - // character unilaterally - confirm the intended sigil before wiring this - // branch up to a reachable condition. + } else if(variable.ifNext("&")) { renderVariableName(variable, name, modifier); - return getenv(name.c_str()); + const char *envValue = getenv(name.c_str()); + if(envValue == NULL) + throw coreutils::Exception("environment variable is not set."); + coreutils::MString envValueStr(envValue); + return processModifier(envValueStr, modifier); } else if(variable.ifNext("^")) { renderVariableName(variable, name, modifier); return global.cookies.data[name];