Skip to content

Commit

Permalink
LDEV-3451 add a test to use cfapplication to override defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jul 21, 2023
1 parent 3a3c1b9 commit 212c3e1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public static Struct call(PageContext pc, boolean suppressFunctions) throws Page
Struct xmlFeatures = acs.getXmlFeatures();
if (xmlFeatures == null) xmlFeatures = new StructImpl();
Struct sxml = new StructImpl(Struct.TYPE_LINKED);
sxml.setEL("secure", Caster.toBoolean(xmlFeatures.get("secure", true)));
sxml.setEL("disallowDoctypeDecl", Caster.toBoolean(xmlFeatures.get("disallowDoctypeDecl", true)));
sxml.setEL("externalGeneralEntities", Caster.toBoolean(xmlFeatures.get("externalGeneralEntities", false)));
sxml.setEL("secure", xmlFeatures.get("secure", true));
sxml.setEL("disallowDoctypeDecl", xmlFeatures.get("disallowDoctypeDecl", true));
sxml.setEL("externalGeneralEntities", xmlFeatures.get("externalGeneralEntities", false));
sct.setEL("xmlFeatures", sxml);

sct.setEL("customTagPaths", toArray(ac.getCustomTagMappings()));
Expand Down
14 changes: 14 additions & 0 deletions test/tickets/LDEV1676.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" labels="xml" {
expect( trim( result ) ).toBe("lucee");
});

// check if we can inline disable the settings back to the old behavior
it( title="Check xmlFeatures default, bad xml, cfapplication override",body = function ( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#/LDEV1676.cfm",
forms : {
scene: "default",
doctype: true,
entity: true,
cfapplicationOverride: true
}
).filecontent;
expect( trim( result ) ).toInclude("http://update.lucee.org/rest/update/provider/echoGet/cgi");
});

});

describe( "check bad config handling", function () {
Expand Down
1 change: 1 addition & 0 deletions test/tickets/LDEV1676/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ component {
param name="FORM.Scene";
param name="FORM.docType" default="true";
param name="FORM.entity" default="true";
param name="FORM.cfapplicationOverride" default="false";

switch (FORM.Scene){
case "externalGeneralEntities-True":
Expand Down
11 changes: 9 additions & 2 deletions test/tickets/LDEV1676/LDEV1676.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
</cfif>
</cfsavecontent>
<cfscript>
if (form.cfapplicationOverride){
//systemOutput("cfapplicationOverride", true)
application action="update" xmlFeatures={
"externalGeneralEntities": true,
"secure": false,
"disallowDoctypeDecl": false
};
}
/*
settings = getApplicationSettings();
Expand All @@ -31,9 +40,7 @@
//systemOutput( result, true );
echo( result );
} catch (e) {
//systemOutput(cfcatch.type & " " & cfcatch.message, true);
echo( cfcatch.type & " " & cfcatch.message );
}
</cfscript>

0 comments on commit 212c3e1

Please sign in to comment.