aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-24 16:14:08 +0200
committerAdrian Kummerländer2014-05-24 16:14:08 +0200
commitbf88fb942d624f40218716d375744aa14b3406a8 (patch)
treefa8ac29589526595ac0f59b90547d3a1364b1168 /src
parent085935ddd577b0c65b4330318b5ba20492d93126 (diff)
downloadInputXSLT-bf88fb942d624f40218716d375744aa14b3406a8.tar
InputXSLT-bf88fb942d624f40218716d375744aa14b3406a8.tar.gz
InputXSLT-bf88fb942d624f40218716d375744aa14b3406a8.tar.bz2
InputXSLT-bf88fb942d624f40218716d375744aa14b3406a8.tar.lz
InputXSLT-bf88fb942d624f40218716d375744aa14b3406a8.tar.xz
InputXSLT-bf88fb942d624f40218716d375744aa14b3406a8.tar.zst
InputXSLT-bf88fb942d624f40218716d375744aa14b3406a8.zip
Prevented FilesystemContext from resolving absolute paths
* there are situations where one may pass absolute paths to external functions which should not be resolved against the context path ** for example when reading files found by "read-directory" through its "full" value node * this could be checked by the external functions themself ** but as this check is required by all of them it is better implemented in the FilesystemContext
Diffstat (limited to 'src')
-rw-r--r--src/function/read_directory.cc4
-rw-r--r--src/support/filesystem_context.cc8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/function/read_directory.cc b/src/function/read_directory.cc
index a3995ec..f4baff6 100644
--- a/src/function/read_directory.cc
+++ b/src/function/read_directory.cc
@@ -37,8 +37,8 @@ xercesc::DOMDocument* FunctionReadDirectory::constructDocument(
switch ( boost::filesystem::status(p).type() ) {
case boost::filesystem::regular_file: {
- result.setAttribute("type", "file");
- result.setValueNode("name", p.stem().string());
+ result.setAttribute("type", "file");
+ result.setValueNode("name", p.stem().string());
result.setValueNode("extension", p.extension().string());
break;
diff --git a/src/support/filesystem_context.cc b/src/support/filesystem_context.cc
index a30bccc..eba7e45 100644
--- a/src/support/filesystem_context.cc
+++ b/src/support/filesystem_context.cc
@@ -20,7 +20,13 @@ FilesystemContext::FilesystemContext(const std::string& path):
boost::filesystem::path FilesystemContext::resolve(
const std::string& path) const {
- return absolute(this->path_ / path);
+ const boost::filesystem::path targetPath(path);
+
+ if ( targetPath.is_absolute() ) {
+ return targetPath;
+ } else {
+ return absolute(this->path_ / targetPath);
+ }
}
boost::filesystem::path FilesystemContext::resolve(