Opened 15 years ago
Closed 15 years ago
#67 closed enhancement (fixed)
Determine Fusion's handling of relative paths for MapFiles
|Reported by:||jfournier||Owned by:||pdeschamps|
|External ID:||Operating System:||All|
Change History (3)
comment:1 by , 15 years ago
|Milestone:||1.1 → 2.0|
|Priority:||P2 → P1|
|Severity:||Major → Critical|
|Type:||task → enhancement|
comment:2 by , 15 years ago
|Status:||new → assigned|
comment:3 by , 15 years ago
|Status:||assigned → closed|
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.
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.