Opened 16 years ago

Closed 16 years ago

#67 closed enhancement (fixed)

Determine Fusion's handling of relative paths for MapFiles

Reported by: jfournier Owned by: pdeschamps
Priority: P1 Milestone: 2.0
Component: MapServer Version: 1.0.6
Severity: Critical Keywords:
Cc: Browser: All
External ID: Operating System: All
state: New


Fusion seems to require absolute paths in a MapServer MapFile in order to work if outside the application directory. This task is to determine exactly what's going on and, if there's an issue, how to address it.

Change History (3)

comment:1 by pagameba, 16 years ago

Milestone: 1.12.0
Priority: P2P1
Severity: MajorCritical
Type: taskenhancement

The code is very dumb, it just uses the path you provide to open the map file. If relative paths would work at all right now, it would be relative to LoadMap.php.

I think that a good solution would be to allow setting a value in the configuration file that sets the root folder for map files and then only files within that folder will be considered (and the paths would be relative to that folder).

So we would add the following to config.json:






(ignoring other settings that are in there)

Then LoadMap.php (for MapServer) would be modified to check to see if the mapfile path is relative or absolute - if relative, then it would append it to the mapfileroot value. In both cases it would check the final real path against the mapfileroot to see if the path is valid.

What happens if the mapfileroot value is not set? Do we assume a default? What about a default relative path (the fusion root directory)? This makes me think that we should do two things:

1) mapfile relative path is taken from either the mapfileroot if specified or the fusion directory itself 2) if mapfileroot is specified then the final path is restricted to being within the mapfileroot.


comment:2 by pdeschamps, 16 years ago

Owner: changed from madair to pdeschamps
Status: newassigned

comment:3 by pdeschamps, 16 years ago

Resolution: fixed
Status: assignedclosed

added mapfileroot to config.json.

With a file_exists call LoadMap.php now looks first for a path relative from the fusion root by default. If mapfileroot is specified in config.json it will try that specified path with a file_exists call as well, If both of these fail then it uses an absolute path. (for backwards compatibility)

Note: See TracTickets for help on using tickets.