|
| 1 | +component extends="org.lucee.cfml.test.LuceeTestCase" skip=false { |
| 2 | + |
| 3 | + function run( testResults, testBox ){ |
| 4 | + describe( "LDEV-5934: Include template with ../ from mapped directory", function(){ |
| 5 | + it( "should resolve ../ relative to physical directory, not virtual mapping", function(){ |
| 6 | + local.result = _InternalRequest( |
| 7 | + template: "#testMappingVirtual#/sub/test.cfm" |
| 8 | + ); |
| 9 | + expect( result.filecontent.trim() ).toBe( "success" ); |
| 10 | + }); |
| 11 | + }); |
| 12 | + } |
| 13 | + |
| 14 | + // Before all tests, set up the mapping and files |
| 15 | + function beforeAll(){ |
| 16 | + variables.testMappingVirtual = "/ldev5934test"; |
| 17 | + variables.testDir = getTempDirectory() & "LDEV5934/"; |
| 18 | + variables.subDir = variables.testDir & "sub/"; |
| 19 | + |
| 20 | + // Create directory structure |
| 21 | + directoryCreate( variables.testDir, true, true ); |
| 22 | + directoryCreate( variables.subDir, true, true ); |
| 23 | + |
| 24 | + // Create the target file at the root level (one level up from sub/) |
| 25 | + fileWrite( variables.testDir & "target.cfm", "success" ); |
| 26 | + |
| 27 | + // Create the test file in the sub directory that includes ../target.cfm |
| 28 | + fileWrite( variables.subDir & "test.cfm", '<cfinclude template="../target.cfm">' ); |
| 29 | + |
| 30 | + // Add mapping |
| 31 | + application action="update" mappings={ |
| 32 | + "#variables.testMappingVirtual#": variables.testDir |
| 33 | + }; |
| 34 | + } |
| 35 | + |
| 36 | + // After all tests, cleanup |
| 37 | + function afterAll(){ |
| 38 | + // Remove mapping |
| 39 | + application action="update" mappings={ |
| 40 | + "#variables.testMappingVirtual#": nullValue() |
| 41 | + }; |
| 42 | + |
| 43 | + // Note: Per test guidelines, leave artifacts for inspection |
| 44 | + // Only cleanup would be done before the test, not after |
| 45 | + } |
| 46 | + |
| 47 | +} |
0 commit comments