ui5-tooling icon indicating copy to clipboard operation
ui5-tooling copied to clipboard

Adapters are writing files to incorrect locations when virBasePath is not matched

Open matz3 opened this issue 6 years ago • 0 comments

Expected Behavior

Adapters should have a better error handling for invalid file paths (virBasePath not matched).

Current Behavior

Memory

const workspace = resourceFactory.createAdapter({
	virBasePath: "/resources/"
});

workspace.write(resourceFactory.createResource({
	path: "/test/lib/messagebundle.properties",
	string: "KEY=VALUE"
})).then(() => {
	workspace.byPath("/resources/essagebundle.properties").then((res) => {
		console.log(res.getPath());
		// => /test/lib/messagebundle.properties
	});
});

FileSystem

const workspace = resourceFactory.createAdapter({
	fsBasePath: "./foo",
	virBasePath: "/resources/"
});

workspace.write(resourceFactory.createResource({
	path: "/test/lib/messagebundle.properties",
	string: "KEY=VALUE"
})).then(() => {
	workspace.byPath("/resources/essagebundle.properties").then((res) => {
		console.log(res.getPath());
		// => /test/lib/messagebundle.properties
	});
});

matz3 avatar Feb 25 '19 14:02 matz3