[Plugins / Tags] Method disablePreview recieve escaped path for argument of type 'file'
Expected Behavior
module.exports.templateTags = [
{
disablePreview(args) {
console.log(args[0]); // <--------
// Expected
// > obj {type: 'string', value: 'C:\Users\Roman.Komarevtsev\test.json', quotedBy: "'"}
return false;
},
args: [
{
displayName: 'Filename 1',
type: 'file'
}
],
async run(_context, arg1) {
console.log(arg1);
// out: string 'C:\Users\Roman.Komarevtsev\test.json'
}
}
]
Actual Behavior
module.exports.templateTags = [
{
disablePreview(args) {
console.log(args[0]); // <--------
// Actual
// > obj {type: 'string', value: 'C:UsersRoman.Komarevtsevtest.json', quotedBy: "'"}
return false;
},
args: [
{
displayName: 'Filename 1',
type: 'file'
}
],
async run(_context, arg1) {
console.log(arg1);
// out: string 'C:\Users\Roman.Komarevtsev\test.json'
}
}
]
Reproduction Steps
No response
Is there an existing issue for this?
- [X] I have searched the issue tracker for this problem.
Additional Information
When I'm writing new plugin with a custom tag, I ran into a problem that a argument of type 'file' passed as a parameter of disablePreview(args) (also affects liveDisplayName) contains escaped Windows path (all file separators are trimmed).
Example:
Real path: C:\Users\Roman.Komarevtsev\test.json
Passed value (args[0].value): C:UsersRoman.Komarevtsevtest.json
Meanwhile, async run(context, ...args) receive a correct path, which can be consumed by fs.readFileSync(...).
I'd like to get a real path in a disablePreview or liveDisplayName because for my tag logic I need to construct well-formed instance of URL.
Full example available here: https://gist.github.com/iRomul/06a2080e4dd8c0f2dd7b8a4a6e67c871
Insomnia Version
8.6.1
What operating system are you using?
Windows
Operating System Version
Windows 10 Enterprise LTSC 21H2 19044.3930
Installation method
Windows installer from insomnia.rest
Last Known Working Insomnia version
No response